Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Containers in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by