MATLAB Answers

0

Plot error with axes handles with 2014/15b

Asked by Charlie Blackwall on 17 Dec 2015
Latest activity Commented on by Mike Garrity
on 17 Dec 2015
I've just upgraded to 2015b from 2013b and have found that the majority of the plotting routines that previously worked, now throw up a number of errors. It appears to be the way that the axes handle is being used.
In my code I call a function to create the GUI and then populate it with data which is in the GUI workspace.
% Function to create the GUI
[AxesPlot,ImportBut,AcceptBut, LimitTxt]=ImportMinMaxGUI;
% AxesPlot is the handle for the axes in the GUI.
Series = plot(AxesPlot,[MaxClip, MinClip]);
MaxClip and MinClip are two different arrays, MaxClip is constructed of MaxClip(i).X, and MaxClip(i).Y and MinClip is purely MinClip.X and MinClip.Y.
When I try and call this I have the following error:
Error using plot
A numeric or double convertible argument is expected
Error in ImportMinMaxFunc(line 118)
Series = plot(AxesPlot,[MaxClip, MinClip]);
However, I know it's not down to the input data as the following does work and creates a plot.
Series = plot([MaxClip, MinClip]);
The trouble is that I have numerous axes and need to put various pieces of data on different axes. I've noticed when I pause and debug that 'AxesPlot' is now an object rather than a double - do I need to refer to it differently when trying to plot to this axes?

  2 Comments

Charlie - according to the documentation found at plot and axes input, an axes object can be passed in as the first parameter to the plot function. What happens if you try something like
plot(AxesPlot,1,2);
vs
plot(AxesPlot,1);
Do both work, or do you still observe the same error message? (Unfortunately, I am still working with R2014a so can't try to reproduce your problem.)
I didn't follow this bit:
MaxClip and MinClip are two different arrays, MaxClip is constructed
of MaxClip(i).X, and MaxClip(i).Y and MinClip is purely MinClip.X
and MinClip.Y.
Do you mean that MaxClip and MinClip are structs? I think it would help if you included the output of whos. This would probably be useful too.
size([MaxClip,MinClip])

Sign in to comment.

0 Answers