MATLAB hangs on function call from Windows system prompt

1 回表示 (過去 30 日間)
John Harris
John Harris 2017 年 12 月 27 日
コメント済み: Philip Borghesani 2018 年 4 月 18 日
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.

採用された回答

John Harris
John Harris 2018 年 1 月 4 日
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 件のコメント
John Harris
John Harris 2018 年 4 月 18 日
See bug 1688960 for updates
Philip Borghesani
Philip Borghesani 2018 年 4 月 18 日
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.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by