need help creating standalone gui using m-file (no fig file, not using GUIDE)

Hello--
I created a GUI in editor (not GUIDE) using just an m-file (no fig file). I then used deploytool to build & package (no problems with this).
Everything installs fine (including MCR) on a non-MATLAB PC, but upon running the GUI EXE, the EXE appears briefly in the task manager process list and then quickly disappears, and the GUI does not appear at all. Also, a beep can be heard, suggesting an error and not just a successful (but really fast) open & close.
Is there some protocol I need to follow when trying to create a Windows standalone GUI in this manner (i.e., not using GUIDE & no fig file)? Do I need to initialize the m-file (and/or any created figures) in some particualr way?
Using R2010a, Windows XP, & Windows 7 (all 64-bit).
Thanks in advance for any advice/suggestions.
Jude

4 件のコメント

Paulo Silva
Paulo Silva 2011 年 2 月 24 日
try fldplnfig instead of h.fldplnfig in the figure handle
Jude Kastens
Jude Kastens 2011 年 2 月 24 日
Let me add that I have tried to run the GUI EXE from the DOS prompt just to see what happens, and received the following error:
Input argument "h" is undefined.
MATLAB: inputArgUndefined
Here are the beginning lines of my code, in case this helps expose what I'm missing:
--------------------------
function [] = fldplnfigGui
opengl software
scr = get(0,'Screensize'); % Get screensize.
scrctr = [scr(3)/2 floor(5*scr(4)/8)];
%================================
% Main Figure object
%--------------------------------
h.fldplnfig = figure(...
'Position',[scrctr(1)-350,scrctr(2)-400,730,600],...
'Resize','off',...
'NumberTitle','off',...
'Menubar','none',...
'ToolBar','none',...
'Color',[0.9608 0.8706 0.7020]); % wheat
%================================
--------------------------
From here, I go right into initializing variables & laying out the controls on the figure. 'h' is a structure that I drag around and manipulate everywhere with all the important information that different parts of the GUI need.
Jude
Jude Kastens
Jude Kastens 2011 年 2 月 24 日
Thanks much, Paulo!
Instead of replacing the figure handle, I simply initialized h ("h = struct;"), and the standalone seems to work now.
Jude
Paulo Silva
Paulo Silva 2011 年 2 月 24 日
great :)

サインインしてコメントする。

回答 (1 件)

Wendy Fullam
Wendy Fullam 2012 年 9 月 24 日
Paulo answered in comments:
try fldplnfig instead of h.fldplnfig in the figure handle

カテゴリ

ヘルプ センター および File ExchangeApp Building についてさらに検索

質問済み:

2011 年 2 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by