MATLAB: How to display the name of a cell plot

'displaynamecellfunplot

So right now I am using cellfun(@plot,My_cell) to plot a function from each column vector element in the cell. I would like to have each function plot to be labeled or named within the legend based on the elements in the array m = [1:4], for the four elements in the cell. How can I do this?

Best Answer

figure;
hold on
a={1:10 sin(1:10) cos(1:10)}
cellfun(@plot,a)
leg={'fig1' 'fig2' 'fig3'}
legend(leg)
Related Question