I'm experiencing this error when handling a function of my axes
??? Error using ==> plot Vectors must be the same lengths.
Error in ==> BrakeDiscAnalysis>Plot_pushbutton_Callback at 595 plot(forceAxes,x,y,'-r')
How can I rectify this error? Below's my script
function Plot_pushbutton_Callback(hObject, eventdata, handles) global ForceAxes Df = str2num(get(handles.FrontRo_text,'string')); forceAxes = ForceAxes; %axes(ForceAxes); df = linspace(0,Df(1),80) x = df/Df(1); y = (1+x)/2;
hold on plot(forceAxes,x,y,'-r')
No products are associated with this question.
What is the global variable ForceAxes? When you pass ForceAxes into plot(), it expects it to be a handle, like a floating point number that is the ID number of the axes. It's probably not that. Who knows what it is? Why don't you just pass in the handles to the axes directly:
plot(handles.forceAxes, x, y, 'r-');
Apparently ForceHandle isn't a valid axis handle; hence plot() thinks the x,y data are the handle and the x vector.
Use ishandle to test if it is a valid graphics handle;
doc ishandle % and links for more details
Play games and win prizes!Learn more