Clear Filters
Clear Filters

How to get rid of undefined plotting handles!

1 view (last 30 days)
Hi, I have a dependent variable want to plot it verse four different variables each time, by fixing two of the properties then in each loop I fixed the third variable and draw the dependent variable with the fourth one. At the end, I will have a figure specified by two variables and one variable on the horizontal axis with punch of curves that represent the third variable. I am using errorbar in my plotting and returning a handle in each time the errorbar is executed.
subplot(2,2,1);P(1,Y,e)=errorbar(wl,TRIALS(:,3),TRIALS(:,4),'o');
set(P(1,Y,e),'Marker',SAmple,'Color',COlor,'MarkerEdgeColor',COlor,'MarkerFaceColor',COlor,'DisplayName',['Tp= ' num2str(Tp(ti))]);hold on;
then when I tried to add the legend I used :
subplot(2,2,1); lgd=legend (P(1,4,:));
it worked for some plots but for others it did not! what I recognized is that some of P values are not defined so I got an error message:
Error using legend>process_inputs (line 554)
Invalid argument. Type 'help legend' for more information.
Error in legend>make_legend (line 306)
[autoupdate,orient,location,position,children,listen,strings,propargs] = process_inputs(ha,argin); %#ok
Error in legend (line 259)
make_legend(ha,args(arg:end),version);
Any ideas? Thanks,

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!