If matlab -desktop elseif matlab -nodesktop

11 Ansichten (letzte 30 Tage)
Andrea Stevanato
Andrea Stevanato am 23 Jun. 2018
Kommentiert: Jan am 29 Jul. 2020
How i can check if my scripts/functions running with gui matlab or not? something like this:
if "matlab -desktop"
%
else
%
end

Akzeptierte Antwort

Jan
Jan am 23 Jun. 2018
  3 Kommentare
Edward
Edward am 27 Jul. 2020
I don't understand from this answer what is the correct conditional to use to check whether or not Matlab was launched without the desktop. Can you please elaborate?
Jan
Jan am 29 Jul. 2020
if usejava('desktop')
disp('This Matlab instance runs with a desktop')
else
% No message here due to the missing comamnd window.
end
Alternatively:
if java.lang.System.getProperty('java.awt.headless')
% No command window...
else
disp('This Matlab instance runs with a desktop')
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by