GUI closing unexpectedly once published as an application?

Hi, I have written a fully working GUI. I then wanted to add more functionality by bringing up a further GUI when a push button is pressed. This all seems to work fine when run from inside MATLAB. However, once the application is published using applicationCompiler, when that button is pressed the second GUI appears for a fraction of a second and then disappears/closes. The second GUI is called using:
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
FuncGen2;
I attach the code for the second GUI (FuncGen2) as well.

 採用された回答

Robert Cumming
Robert Cumming 2014 年 7 月 30 日

1 投票

run the exe from a command prompt and it will write any error message to that window - that should help you debug.

5 件のコメント

Jasmine
Jasmine 2014 年 7 月 30 日
Thanks, on the quick response. I'm afraid I have done this and whilst it means that the GUI now runs like the .exe does outside of MATLAB, unfortunately no error/warning messages show at the command line.
Robert Cumming
Robert Cumming 2014 年 7 月 30 日
I meant run compiled exe from the windows cmd prompt.
Jasmine
Jasmine 2014 年 7 月 30 日
Ah, sorry I understand now. The issue seems to be be with this line:
t = amp*(square(2*pi*freq*x))+off;
It says Error using + Matrix dimensions must agree.
x is a vector containing times values and the other variables are constants set by the user, using edit boxes.
Robert Cumming
Robert Cumming 2014 年 7 月 30 日
Thats your error then - at runtime that is causing a crash which is the reason your code fails.
You should perform checks on the values provided by the user from the edit boxes before running the line (or the lazy way is to wrap in a try/catch)
Jasmine
Jasmine 2014 年 7 月 30 日
Ah I think I may have found my error. Its the old case of trying to do something (in this case, draw a graph) without having initialised all of the values. Therefore, I think my offset (off) was not set to anything (or more likely [] (i.e. not a number))and so of course it could not evaluate the expression above.
Thank you for suggest the cmd prompt, most helpful :)

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

その他の回答 (0 件)

カテゴリ

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

製品

質問済み:

2014 年 7 月 30 日

コメント済み:

2014 年 7 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by