Total Number of 24 matrix (3*3) but this code show only one matrix 3*3 how to see full iteration in command window

1 visualización (últimos 30 días)
Arr=100; POpu=3; TAppi=3; XLb=50; XUp=100; for Arr=1:Arr for i=1:3 for j=1:3 Pare(i,i)=XLb+rand(1)*(XUp-XLb); %Calculating Initally Generated Number% end end end

Respuesta aceptada

John Chilleri
John Chilleri el 12 de En. de 2017
Editada: John Chilleri el 12 de En. de 2017
I'm not entirely sure of your problem, but if you're trying to keep all of the Pare matrices generated, try this:
Arr=100;
POpu=3;
TAppi=3;
XLb=50;
XUp=100;
for Arr=1:Arr
for i=1:3
for j=1:3
Pare(i,j,Arr)=XLb+rand(1)*(XUp-XLb);
% Calculating Initally Generated Number
end
end
end
You're overwriting the Pare matrix each step so you lose the previous one, the above code saves all of them.
Also, do you mean Pare(i,i) or Pare(i,j)?
Hope this helps!
  2 comentarios
John Chilleri
John Chilleri el 12 de En. de 2017
Editada: John Chilleri el 12 de En. de 2017
Also, a simpler solution to your problem is:
Arr=100;
POpu=3;
TAppi=3;
XLb=50;
XUp=100;
Pare = XLb + rand(3,3,Arr)*(XUp-XLb);
Also, did you want to say for i = 1:3 or 1:P0pu/1:TAppi, or in this case, rand(P0pu,TAppi,Arr)? I ask because if you attempt to use this in the future and change P0pu/TAppi to see nothing changes, you'll know why.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Just for fun 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