startup.m for Matlab in Docker does not execute some commands

조회 수: 1 (최근 30일)
Nasser Hosseini
Nasser Hosseini 2024년 3월 13일
편집: Nasser Hosseini 2024년 3월 25일
Hi!
startup.m for Matlab in Docker does not execute some commands, for instance a simple disp() in the example below:
function startup
% Setup default proxy settings based on the environment variables that
% we will have set in the run.sh script
host = getenv('MW_PROXY_HOST');
port = getenv('MW_PROXY_PORT');
if ~isempty(host) && ~isempty(port)
% Replace the deprecated JAVA API with a wrapper
matlab.net.internal.copyProxySettingsFromEnvironment();
end
addpath('/tmp/windows-file-share/MATLAB/BFR2LocMEdrive'); %OK
cd ('/tmp/windows-file-share/MATLAB/BFR2LocMEdrive'); %OK
disp('Welcome!') % !!!! NOT EXECUTED !!!
end
Does anybody know the reason for this behaviour and if it can be fixed?

채택된 답변

Karanjot
Karanjot 2024년 3월 23일
Hi Nasser,
Debugging commands are not designed to work when MATLAB is started as an automation server. This is because most applications that use the Automation server run without user interaction and would not benefit from having messages displayed to the command window.
The debugging functions that will not work in Automation mode include:
FPRINTF
SSCANF
DISP
A workaround is to use the MSGBOX command to display a status message in a pop-up message box. It is possible to modify the string displayed in a message box instead of creating new message boxes for each status message. For example:
m = msgbox('Original Message')
t= findobj(m,'type','text')
set(t,'String',{'Modified Message'})
Another option is to store the output of a debugging command such as DISP into a string by using the EVALC function. This string can then be pulled into the client application and displayed for debugging purposes.
  댓글 수: 1
Nasser Hosseini
Nasser Hosseini 2024년 3월 25일
편집: Nasser Hosseini 2024년 3월 25일
Thank you very much for your detaild answer! msgbox works fine!
Have a nice day!
/Nasser

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by