can I abbreviationv these steps to few steps?

v_now=zeros(111,34);
v_now(1,2:33)=100;
v_now(6,14:21)=100;
v_now(5,2:5)=0;
v_now(5,30:33)=;

5 comentarios

You could use sub2ind() to convert all of the row/column indices to linear indices, and then set
v_now(linear_indexes)= 100
However, I think this approach would make it more complex than the way you have it now, so I'd leave it as you've shown.
Mary Jon
Mary Jon el 4 de Oct. de 2013
ok,
Image Analyst
Image Analyst el 4 de Oct. de 2013
It already is a few steps.
Mary Jon
Mary Jon el 4 de Oct. de 2013
ok
Walter Roberson
Walter Roberson el 5 de Oct. de 2013
You could remove the v_now(5,2:5)=0; as those locations were already set to 0 because you used zeros() to initialize the matrix.

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Preguntada:

el 4 de Oct. de 2013

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by