Error while opening matlab GUI

Hi,
I am not very much used to working with Matlab. But, I had used a set of matlab scripts with version 2012 a few years ago. These set of scripts are accompanied by a GUI, which used to work very well with version 2012 of matlab. Now when I am trying to run this in 2018b, I get a set of errors. I am not sure how to resolve this issue. Can you please point me to what is causing the error?
>> ion
Error using mat2cell (line 45)
Not enough input arguments.
Error in ion>ion_OpeningFcn (line 66)
set(handles.dataSetPopUp,'String',mat2cell(1:8));
Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in ion (line 42)
gui_mainfcn(gui_State, varargin{:});
When I use the ion.fig file, I am able to use the GUI. However, when I load the user file I again get a set of errors. These are below:
>> uiopen('code\NewGUI\NewGUI\ion.fig',1)
pathstr =
0×0 empty char array
name =
'01112018_FK_010'
ext =
'.img'
Dot indexing is not supported for variables of this type.
Error in load_ion>fileChooser (line 115)
numOfSlots = feval(mainHandle.getNumberOfSlots,mainHandle);
Error in load_ion>load_ion_OpeningFcn (line 63)
fileChooser(handles);
Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in load_ion (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in ion>load_Var_Callback (line 1109)
load_ion(handles)
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in ion (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ion('load_Var_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating Menu Callback.
Can someone please point me to how I can resolve this?

Risposte (1)

Guillaume
Guillaume il 11 Nov 2018
Right now, the error you're getting is from line 66:
set(handles.dataSetPopUp,'String',mat2cell(1:8));
and matlab is telling you that you're not passing enough input arguments to mat2cell. This is true, even in R2012a, mat2cell requires at lest 2 input arguments and you're only passing one the vector 1:8. So if that line was present in R2012 it would never have worked.
If I understand the intent of that line correctly, you could fix it in R2018b with:
set(handles.dataSetPopUp,'String',string(1:8));
A fix compatible with both R2012 and R2018b would be:
set(handles.dataSetPopUp,'String',arrayfun(@num2str, 1:8, 'UniformOutput', false));
Note that R2014b introduced major changes to graphics handling in matlab. It is very likely that a 2012 GUI that relies heavily on graphics will require that changes for it to work in any version >= R2014b.

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Richiesto:

il 11 Nov 2018

Risposto:

il 11 Nov 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by