How to create larger matrix within a loop?

I have the code below, I need to create a matrix with all DATA values in the rows
(DATA_new=[DATA;DATA;....] but the problem is that the MATLAB save the last value
of DATA. I don't know how I can have a bigger matrix with all DATA vectors! Does
anyone know that?
for m=0:11;
m=m+1;
for n=1:15;
DATA =[m,n]
end
end

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 16 de Jul. de 2016
Editada: Azzi Abdelmalek el 16 de Jul. de 2016
DATA=[]
for m=0:11;
m=m+1;
for n=1:15;
DATA =[DATA;m,n]
end
end
You can do it without for loop
[x,y]=meshgrid(1:12,1:15)
DATA=[x(:) y(:)]

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 16 de Jul. de 2016

Comentada:

el 16 de Jul. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by