I have 13 lines in the chart, each line corresponds to a data set from a text file. I would like to mark each row, starting with the first data set, as 1.2, then at 1.25, 1.30, 1.80, etc., And each step is 0.05. If I printed it manually, it would be
legend('1.20','1.25','1.30', ...., '1.80')
However, in the future I may have more than 20 lines on the chart. Therefore, to print each of them is unrealistic. I tried to create a loop in the legend and it does not work.
How can I do this in a practical way?
N_FILES=13 ; N_FRAMES=2999 ; a=1.20 ;b=0.05 ; phi_matrix = zeros(N_FILES,N_FRAMES) ; for i=1:N_FILES eta=a + (i-1)*b ; fname=sprintf('phi_per_timestep_eta=%3.2f.txt', eta) ; phi_matrix(i,:)=load(fname); end figure(1); x=linspace(1,N_FRAMES,N_FRAMES) ; plot(x,phi_matrix) ;
Need help here:
legend(a+0*b,a+1*b,a+2*b, ...., a+N_FILES*b)
source share