How can I use guidata to pass 2 different variables in 2 different callbacks of a GUI?
Show older comments
My GUI is required to-
Browse for .mat and .wav files. Store the file names in storedStructure and storedStructure1.
Use load and wavread in seperate callbacks and plot those 2 functions.
Upon loading the .wav file, I plotted it without any problems. But there are problems with the .mat file.
Here's my code:
startingFolder = 'C:\Users\Mayank\Desktop\Matlab';
% Get the name of the mat file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.mat');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a mat file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName);
storedStructur = fullFileName;
handles.b = storedStructur;
guidata(hObject,handles);
axes(handles.Sensor);
ema = load(handles.b);
plot(ema);
The error being-
Error using plot
Not enough input arguments.
Error in Speech_Proc>pushbutton10_Callback (line 149)
plot(ema);
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Speech_Proc (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)Speech_Proc('pushbutton10_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!