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 visualización (últimos 30 días)
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)

Respuesta aceptada

Manan Mishra
Manan Mishra el 11 de En. de 2018
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)

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by