Borrar filtros
Borrar filtros

Can these operations be vectorized?

3 visualizaciones (últimos 30 días)
Vinod S
Vinod S el 15 de Oct. de 2012
X=1:100;
T=zeros(10);
for i=1:10
T(i,:)=X((1+(i-1)*10):(10*i));
end
Please tell me how to do these operations without using the FOR Loop.
  1 comentario
Matt Fig
Matt Fig el 15 de Oct. de 2012
Why did you use the Code button on your paragraph, but not on the code?? Please fix this.

Iniciar sesión para comentar.

Respuesta aceptada

Matt Fig
Matt Fig el 15 de Oct. de 2012
T = reshape(1:100,10,10).'
  3 comentarios
Matt Fig
Matt Fig el 15 de Oct. de 2012
Give it a try! Did you notice that I took the transpose?
Vinod S
Vinod S el 16 de Oct. de 2012
Yes sir, it does work. Thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by