MATLAB Answers

Is there a workaround to use GUIs created with GUIDE inside a namespace?

5 views (last 30 days)
Duijnhouwer
Duijnhouwer on 9 Oct 2018
Edited: Duijnhouwer on 9 Oct 2018
I run into the problem GUIs created with GUIDE cannot be placed inside a namespace.
For example, i have a namespace folder +ns which contains gui.fig and the corresponding gui.m.
Now, when I run
>> +ns.gui
It fails because this command starts +ns.gui.m which then searches for gui.fig which it can't find because it's hidden in the namespace...
Has anyone figured out a way around this? Is there an edit we can make to the boilerplate code that GUIDE creates so that it looks in the same namespace that the gui.m is in?
Thanks in advance.
Jacob
I pasted the full error below, mostly to facilitate finding this problem.
>> +ns.gui
Error using load
Unable to read file 'gui.fig'. No such file or directory.
Error in matlab.graphics.internal.figfile.FigFile/read (line 31)
hgDataVars = load(filename, '-mat', '-regexp', '^hg[M]');
Error in matlab.graphics.internal.figfile.FigFile
Error in hgload (line 54)
FF = matlab.graphics.internal.figfile.FigFile(filename);
Error in matlab.hg.internal.openfigLegacy (line 57)
[fig, savedvisible] = hgload(filename, struct('Visible','off'));
Error in gui_mainfcn>local_openfig (line 286)
gui_hFigure = matlab.hg.internal.openfigLegacy(name, singleton, visible);
Error in gui_mainfcn (line 158)
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
Error in ns.gui (line 40)
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.