Compiled uitable crashes in standalone application

조회 수: 5(최근 30일)
Phillip 2014년 4월 30일
댓글: Friedrich 2014년 5월 2일
I have created a programmatic GUI which I compile into a stand-alone application. When I run it from Matlab every thing works fine. I compile the GUI and it compiles and packages fine.
When I run the actual .exe it works fine until just before the end of the code where it creates a uitable. The application then hangs. From outputting to a log file I know that it's hanging at the uitable creation line:
t = uitable('Data',cellData,'ColumnName',{'Col1','Col2'});
I did research on this and from my limited understanding it seems to be that matlab "outsources" this to Java Event Dispatcher. Matlab then carries on and things go out of sync causing the application to hang indefinitely.
The solution is apparently to issue a drawnow and/or pause(someSmallTime) command. Playing around with this I had to do the following:
t = uitable('Data',cellData,'ColumnName',{'Col1','Col2'});
This does work but if the deployed machine is slow or busy with other stuff the 0.1 secs might not be enough. It just doesn't seem the correct way to do things.
This application is going to be a complex GUI in the end with lots of sub GUIs etc.
I would like to know if there is a better solution for this or if my design is wrong. Basically what can I do to make sure I don't need to worry about all the graphics updating/flushing before I invest to heavily in this GUI.
Regards, Phillip


Sean de Wolski
Sean de Wolski 2014년 5월 1일
Use a drawnow as you have. This will flush the event queue which will force MATLAB to hold until this happens regardless of how slow the computer is.
pause() is only useful because it implicitly calls drawnow, not because of the pause amount.
  댓글 수: 2
Friedrich 2014년 5월 2일
Run the application from a console/DOS prompt and see if any errors are thrown.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by