MATLAB hangs on function call from Windows system prompt

2 views (last 30 days)
In R2017b, I want to verify installation of a toolbox with installedAddons, and control the toolbox using the enableAddon and disableAddon functions.
These seem to work well from the matlab command line, but when I try to pass them as part of a command line call from outside matlab, matlab hangs.
From a Windows system prompt , this code should open matlab, show me the path, then spit out a table of installed addons:
c:\>matlab -r "path; matlab.addons.installedAddons"
However, matlab opens, prints the path, and then just hangs: it never displays the installed addons.
I've found this behavior for all of these functions: enableAddon disableAddon installedAddon isAddonEnabled; incidentally, they are new for R2017b.
  1. Does this work, or hang, for you?
  2. Have you encountered/worked around this problem with other functions?
Yes: I've looked for similar issues; found this issue. But the "resolution" there (MATLAB processes the commands as part of its initialization) is not helpful, because the command never gets fully processed and never prints out the installed apps table. The same issue happens with the enable/disable commands. Since my plan is to to verify/manage the addons as part of a build script, I can't be getting stuck at this step or the build won't happen.

Accepted Answer

John Harris
John Harris on 4 Jan 2018
Mathworks support personnel have been helpful, and indicated this issue is being addressed in a future release (hopefully R2018a; I haven't tried it in the R2018a pre-release yet). In the upcoming release that doesn't hang Matlab, here's one caveat: commands following "-r" are executed during program initialization, and the results of the API call
matlab.addons.installedAddons
during initialization will (may?) be different from the results when it is called from the Matlab command line, once the initialization is complete.
The addon configuration is stored in a file called installedAddons.setting and this file controls what addons are loaded at startup. In Windows this is stored in the Appdata folder, so it should work with non-admin permissions.
  2 Comments
Philip Borghesani
Philip Borghesani on 18 Apr 2018
As a work around you might try:
matlab -r "path; start(timer( 'StartDelay', 5 , 'TimerFcn', @(t,e)disp(matlab.addons.installedAddons) ));start(timer( 'StartDelay', 6 , 'TimerFcn', @(t,e)exit) )
The delays might need adjusting for your system. I suggest creating a function to call with -r that does the actual work instead of passing the entire string to run.

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!