There is no reason to use cell arrays for this code, and it actually causes the problem that you are experiencing. A very good data concept is to use the simplest array possible, unless a more complicated array is the only choice. In this case a simple numeric array holds all of that data quite nicely, so there is no need to use a cell array.
M = [0.0274 0.0268 0.0275;...
0.0130 0.0128 0.0124;...
0.0111 0.0108 0.0113;...
0.0110 0.0107 0.0107;...
0.0109 0.0107 0.0107;...
0.0109 0.0107 0.0107;...
0.0109 0.0107 0.0107;...
0.0109 0.0107 0.0107]
plot(M,'-*')
legend({'first','second','third'})
creates this:
Summary: do not make data more complicate than it needs to be, it only makes the code more complicated!
PS: here is an easy way to convert that cell array into a simple numeric matrix:
Best Answer