Multiply a column by a number

조회 수: 86 (최근 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.

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by