Can I force a standlone application to wait until execution is complete?

5 views (last 30 days)
MATLAB: 2013b, win64
I have compile a very simple tool using MATLAB deploytool and it is being compiled as a standalone executable. The tool is then run from the command line.
My issue is that the command exits immediately and does not wait for the function to finish processing (the tool is creating a file that is needed further down the line).
I know that I can do things on the command line to make execution wait, but my delivery stops at the tool and I would like my delivery to be robust to this issue.
Is there something I can do in the main m-function or as a MATLAB compiler option that will force the resulting executable to wait until all processing is finished?

Answers (1)

Walter Roberson
Walter Roberson on 19 May 2016
Some possibilities include:
  • The executable being built includes functions that cannot be deployed, and the executable exits as soon as it tries to use those functions. For example nothing in the symbolic toolbox an be deployed.
  • The executable uses timers or callbacks to do its work, such as waiting for I/O using callbacks. Executables return as soon as the most immediate function call finishes, which destroys any timer or I/O objects. You need to do something like uiwait() or waitfor() something that indicates that your work is finished. For example there is a timer StopFcn callback that can be used to uiresume()
  • The executable is a GUI that relies on callbacks to do its work. This has the exact same difficulty as above. If you built the GUI using GUIDE, look for the uiwait() that is commented out and remove the comment marker, enabling the uiwait().

Sign in to comment.


Find more on MATLAB Compiler 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!

Translated by