i am having matrix of i rows by 3 columns ,now i want to multiple only i rows of 1 columns with 5 upto 100th row after the 100th row ,values has to be as it is.

1 次查看(过去 30 天)
i= 3560 A = (i,3)
now want to multiple A(i,1) with some value say 5 but upto say 100 and then remaining values of rows has to be same.
and want to save New A(i,1) (change) with 1 to 100 i.e multiplied with 5 and remaining unchanged values in New A(i,1)

采纳的回答

Manan Mishra
Manan Mishra 2018-1-11
Let's assume that you want to multiply the first 'x' rows of the first column with a scalar 'n' and update the values in 'A'.
You can use the following command to do this:
>> A(1:x,1) = n*A(1:x,1);
If you want to do this for multiple columns (say first y columns) at once, you can do similar operation by indexing into columns also:
>> A(1:x,1:y) = n*A(1:x,1:y)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by