MATLAB Answers

Multiply a column by a number

276 ビュー (過去 30 日間)
Elaheh
Elaheh 2018 年 3 月 30 日
回答済み: Roger Stafford 2018 年 3 月 30 日
How Could I simply multiply each element of this array by 4? A=array(:,6);

採用された回答

David Fletcher
David Fletcher 2018 年 3 月 30 日
A=A.*4

その他の回答 (1 件)

Roger Stafford
Roger Stafford 2018 年 3 月 30 日
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.

Community Treasure Hunt

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

Start Hunting!

Translated by