I have been trying to compile a MATLAB based GUI and the code compiles without error. The GUI appears properly when running within MATLAB, but when I try to run the executable, the GUI itself does not appear, but is present in the Task Manager. While the program in question is a bit too large to post here, I have been able to duplicate the problem with a much smaller simple GUI. The m-file for the GUI is attached.
I am using MATLAB 2014A on 64 bit Windows 7 Professional.

4 comentarios

Walter Roberson
Walter Roberson el 15 de Sept. de 2015
The file did not get attached
Joel Marchand
Joel Marchand el 15 de Sept. de 2015
Editada: Walter Roberson el 15 de Sept. de 2015
I have attached the m-file. If that fails, the relevant code is below, and can be copied and pasted into a new m-file.
classdef testGUI < handle % TESTGUI Simple GUI to demonstrate that the GUI itself does not show % up when compiled.
properties
h;
incButton;
decButton;
txtBx;
end
methods
function T = testGUI()
T.h = figure();
T.incButton = uicontrol(T.h,...
'style', 'pushbutton',...
'string', 'Increment',...
'callback', @(s,e)T.buttonCallback(s,e),...
'units', 'normalized',...
'position', [0.1, 0.8, 0.8, 0.1]);
T.decButton = uicontrol(T.h,...
'style', 'pushbutton',...
'string', 'Decrement',...
'callback', @(s,e)T.buttonCallback(s,e),...
'units', 'normalized',...
'position', [0.1, 0.6, 0.8, 0.1]);
T.txtBx = uicontrol(T.h,...
'style', 'edit',...
'enable', 'inactive',...
'string', '0',...
'units', 'normalized',...
'position', [0.1, 0.4, 0.8, 0.1]);
end
function buttonCallback(T, s, ~)
num = str2double(get(T.txtBx, 'string'));
if eq(s, T.incButton)
num = num + 1;
elseif eq(s, T.decButton)
num = num - 1;
end
set(T.txtBx, 'string', num2str(num));
end
end
end
Walter Roberson
Walter Roberson el 15 de Sept. de 2015
Does it make a difference if you add a .m that calls the constructor explicitly ?
Joel Marchand
Joel Marchand el 15 de Sept. de 2015
I have tried this, and the GUI still remains elusive.
Specifically, I tried compiling an M-file containing the following code:
function makeAtestGUI() T = testGUI(); uiwait(T.h); end
We have a pretty restrictive security profile on our PCs. Is it possible that something in the security profile is preventing the GUI from appearing? If so, where would I try to look?

Iniciar sesión para comentar.

 Respuesta aceptada

Joel Marchand
Joel Marchand el 21 de Sept. de 2015

0 votos

I just installed 2015B on my computer, and the problem seems to have gone away. While I do not know why it did not work in 2014A, the problem seems to been fixed.

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 15 de Sept. de 2015
Editada: Sean de Wolski el 15 de Sept. de 2015

0 votos

What Walter said.
function makeAtestGUI()
T = testGUI();
uiwait(T.h);
end
Now compile this.

Categorías

Más información sobre Entering Commands en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 15 de Sept. de 2015

Respondida:

el 21 de Sept. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by