Multiply a column by a number

83 Ansichten (letzte 30 Tage)
Elaheh
Elaheh am 30 Mär. 2018
Beantwortet: Roger Stafford am 30 Mär. 2018
How Could I simply multiply each element of this array by 4? A=array(:,6);

Akzeptierte Antwort

David Fletcher
David Fletcher am 30 Mär. 2018
A=A.*4

Weitere Antworten (1)

Roger Stafford
Roger Stafford am 30 Mär. 2018
Let Ar be the name of the array.
Ar(:,6) = 4*Ar(:,6);
What could be simpler? Since 4 is a scalar, it is automatically applied to each element of that column.

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by