I’m trying to import data into a GUI and save it to handles. The .mat-file contains a single struct called log with all the data in it. I’ve made a button using GUIDE and added the following code:
function loadMatFileButton_Callback(hObject, eventdata, handles)
[FileName,PathName] = uigetfile('*.mat');
loadDataName = fullfile(PathName,FileName);
load(loadDataName); % gives log struct
handles.log = log;
But when executing I get this error:
??? Error using ==> log
Not enough input arguments.
Error in ==> VisualizeData>loadMatFileButton_Callback at 160
handles.log = log;
It’s really weird. I’ve tried debugging it by putting a breakpoint after the load command. When I then type handles.log = log manually in the console, it does works… I don’t understand what’s going wrong, but it must be really trivial.
In short : The
Not enough input argumentsis the clue to the mystery. It means that you are using a function rather than a variable.First of all, don’t use
log! It is a built in function – natural logarithm. Of course, you can override it, but that is a bad style.Obviously, you expect that in your code there is some variable named
logand there isn’t. I will leave it as an exercise to the reader to find out why. Hint: Check the .mat file that you are loading.