Saving a vector in a sub for-loop in the main loop
Mostrar comentarios más antiguos
Hello,
I am trying to save the results obtained in the sub loop to the main loop but seems I am getting some errors; below is an example of what I need:
values=zeros(1,3);
for x=1:3
result=zeros(1,10);
for y=1:10
equation1=rand; %just for simplicity
result(y)=equation1; %This is what I want to save in the main loop; in this case it would consist of 30 elements
end
equation2=sum(result);
values(x)=equation2;
end
Any ideas are appreciated!
Thanks in advance.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!