Hi !
I'm trying to plot 8 matrixes (C1 to C8) on 1 plot. For each ploted matrix, I want the corresponding legend (C1 to C8). Below is my code and when I run it, MATLAB returns me :
"Function 'subsindex' is not defined for values of class 'cell'.
Error in matlab_common_plot (line 16) legend(Legend)"
numberfile = 8figuretitle('Spannung vs. Traversenweg - - C')for i=1:numberfilemat_x=eval(['C',num2str(i)]); plot(mat_x(:,2),mat_x(:,6),'-')hold allendhold offxlabel('Traversenweg (mm)')ylabel('Spannung (MPa)')Legend = cellstr( num2str((1:numberfile)','C%d') );legend(Legend)saveas(gca, 'Spannung vs. Traversenweg - -C.jpg', 'jpg');closeend
Best Answer