Clear Filters
Clear Filters

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

4 views (last 30 days)
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?

Accepted Answer

Karanjot
Karanjot on 23 Mar 2024
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 Comment
Nasser Hosseini
Nasser Hosseini on 25 Mar 2024
Edited: Nasser Hosseini on 25 Mar 2024
Thank you very much for your detaild answer! msgbox works fine!
Have a nice day!
/Nasser

Sign in to comment.

More Answers (0)

Categories

Find more on Containers in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!