Home Error in Plotting in matlab GUI axes through listbox by loading .mat file
Reply: 0

Error in Plotting in matlab GUI axes through listbox by loading .mat file

user1461
1#
user1461 Published in April 25, 2018, 12:52 am

I want to plot two variables (x vs y) in already included GUIDE axes from two listboxes populated with different variables. x variable from listbox1 and y variable from listbox2.The listboxes are populated from loading .mat file from user (using uigetfile command). After selecting two variables x & y from listboxes pushbutton2 (plot) is pressed for plotting them on axes1. I am getting following error in plotting these variables on axes1.

Error using plot

Invalid first data argument.

Error in ListBox>pushbutton2_Callback (line 161)

plot(x,y) Error in gui_mainfcn (line 95) feval(varargin{:});

Error in ListBox (line 42) gui_mainfcn(gui_State, varargin{:});

Error in @(hObject,eventdata)ListBox('pushbutton2_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback

I am using following commands to plot on axes1:

[x,y] = get_var_names(handles); % this function returns two variables selected from listboxes.

axes(handles.axes1)

plot(x,y)

I have plotted correctly in new figure with following command

evalin('base',['plot(',x,',',y,')'])

But I want to plot on predefined axes1 in GUI.

I have searched on internet but still not getting solution. I am beginner in GUI building. Comments required Plz...

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.342186 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO