Compiled uitable crashes in standalone application
3 views (last 30 days)
Show older comments
Hi,
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:
drawnow;
t = uitable('Data',cellData,'ColumnName',{'Col1','Col2'});
drawnow;pause(0.1);drawnow;
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
0 Comments
Answers (1)
Sean de Wolski
on 1 May 2014
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 Comments
Friedrich
on 2 May 2014
Run the application from a console/DOS prompt and see if any errors are thrown.
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!