简体   繁体   中英

printing array in a for loop in matlab

i have the following code:

 I=0;
 L=0;
for i=1:20

   m=[I;L];
   hold on
   plot(1:20,m(1:2),'*');

   I=I+1;
   L=5+I;
end

The purpose of this code is in the beggining of each one of the 20 iterations, the table m, to change the values. after this part i want to print the I,L with different plot in the same figure.After that there is code which change again the values of I,L,M. The result i want to be a plot for each one of the I,L.But i don't know how to do this. Any ideas?

Do you mean something like that?

 I_value=0;
 L_value=0;
 I = [];
 L = [];
 for i=1:20
     I_value = I_value + 1;
     L=[5,I];
     I=[I,I_value+1];
 end

 figure;
 plot([I;L]','*');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM