Plot error with axes handles with 2014/15b

2 views (last 30 days)
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
Geoff Hayes
Geoff Hayes on 17 Dec 2015
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.)
Mike Garrity
Mike Garrity on 17 Dec 2015
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.

Answers (0)

Community Treasure Hunt

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

Start Hunting!