Getting started with matlab guide, hit a stumbling block. Got it as simple as I can as a toy gui to illustrate my problem. A gui (named asas) has a pushbutton and an axis. The callback of the button reads
axesHandle= findobj(gcf,'Tag','axes1');
x=rand(randi(10+20,1),4);
plot(axesHandle, x)
There's no other code written by me (guide wrote it).
The 1st time I push the button, everything is fine: the plot gets done. The 2nd time around, I get an error, from the console:
Error using plot
Vectors must be the same lengths.
Error in asas>pushbutton1_Callback (line 83)
plot(axesHandle, x)
Error in gui_mainfcn (line 96)
feval(varargin{:});
etc...
I want to plot the new data x, replacing the old one.
It looks like matlab is not replacing the data to plot, but somehow trying to append to the plot?
I have searched, but haven't found anything that applies.