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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by