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

4 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Containers 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by