Hello,
I am currently having a slightly troublesome issue with a program that I am writing. I would appreciate if anyone could offer me some guidance.
The program consists of a GUI (both the .fig and .m files are made in GUIDE). The goal of the part of the program that is giving me issues is to plot MS Excel data selected by the user from a listbox to an axes in the program. In other words: user selects data set from list box --> user clicks the "plot" pushbutton --> a 2D plot of data from the select excel file seems to magically appear on axes in GUI
In order to attempt to accomplish this task I have done the following:
* FOR THE LIST BOX CALLBACK * I have used a simple "switch val" sequence and the xlsread command to get something like this:
function listbox2_Callback(hObject, eventdata, handles)
val = get(hObject,'val');
switch val
case 1
handles.listbox2 = xlsread('test1.xls', 1, 'A2:B8');
case 2
handles.listbox2 =xlsread('test2.xls', 1, 'A2:B8'); ;
return
end
guidata(hObject,handles)
* FOR THE PUSH BUTTON I HAVE *
function pushbutton1_Callback(src,evnt)
data = str2double(get(handles.listbox2,'String'));
x = data
,1);
y = data
,2);
plot(x,y)
set(handles.axes2,'XMinorTick','on')
grid on
OK so I run the full code with this dysfuntional section and the figure appears - no errors. I click on one of the list box items...it thinks about it and no errors come up. I click "plot" and BANG! I get this...and needless to say no plot of x,y.
??? Error while evaluating uicontrol Callback
??? Error using ==> program2 >pushbutton1_Callback
Too many input arguments.
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> program2 at 48
gui_mainfcn(gui_State, varargin{:});
??? Error using ==> program2('pushbutton1_Callback',gcbo,[],guidata(gcbo))
Error using ==> program2>pushbutton1_Callback
Too many input arguments.
??? Error while evaluating uicontrol Callback
I am very new to programming and especially with GUI's. I've been really pulling my hair out to figure out why im getting "too many input arguments." It seems to me like the data is being found from excel from the listbox selection but i'm not sure...
Any insight or suggestions would be very much appreciated. Thanks for reading.
Best,
Jackie
p.s. This code is in MATLAB v.7.3 R2006b
I am currently having a slightly troublesome issue with a program that I am writing. I would appreciate if anyone could offer me some guidance.
The program consists of a GUI (both the .fig and .m files are made in GUIDE). The goal of the part of the program that is giving me issues is to plot MS Excel data selected by the user from a listbox to an axes in the program. In other words: user selects data set from list box --> user clicks the "plot" pushbutton --> a 2D plot of data from the select excel file seems to magically appear on axes in GUI
In order to attempt to accomplish this task I have done the following:
* FOR THE LIST BOX CALLBACK * I have used a simple "switch val" sequence and the xlsread command to get something like this:
function listbox2_Callback(hObject, eventdata, handles)
val = get(hObject,'val');
switch val
case 1
handles.listbox2 = xlsread('test1.xls', 1, 'A2:B8');
case 2
handles.listbox2 =xlsread('test2.xls', 1, 'A2:B8'); ;
return
end
guidata(hObject,handles)
* FOR THE PUSH BUTTON I HAVE *
function pushbutton1_Callback(src,evnt)
data = str2double(get(handles.listbox2,'String'));
x = data
y = data
plot(x,y)
set(handles.axes2,'XMinorTick','on')
grid on
OK so I run the full code with this dysfuntional section and the figure appears - no errors. I click on one of the list box items...it thinks about it and no errors come up. I click "plot" and BANG! I get this...and needless to say no plot of x,y.
??? Error while evaluating uicontrol Callback
??? Error using ==> program2 >pushbutton1_Callback
Too many input arguments.
Error in ==> gui_mainfcn at 75
feval(varargin{:});
Error in ==> program2 at 48
gui_mainfcn(gui_State, varargin{:});
??? Error using ==> program2('pushbutton1_Callback',gcbo,[],guidata(gcbo))
Error using ==> program2>pushbutton1_Callback
Too many input arguments.
??? Error while evaluating uicontrol Callback
I am very new to programming and especially with GUI's. I've been really pulling my hair out to figure out why im getting "too many input arguments." It seems to me like the data is being found from excel from the listbox selection but i'm not sure...
Any insight or suggestions would be very much appreciated. Thanks for reading.
Best,
p.s. This code is in MATLAB v.7.3 R2006b