If matlab -desktop elseif matlab -nodesktop

6 visualizaciones (últimos 30 días)
Andrea Stevanato
Andrea Stevanato el 23 de Jun. de 2018
Comentada: Jan el 29 de Jul. de 2020
How i can check if my scripts/functions running with gui matlab or not? something like this:
if "matlab -desktop"
%
else
%
end

Respuesta aceptada

Jan
Jan el 23 de Jun. de 2018
  3 comentarios
Edward
Edward el 27 de Jul. de 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 el 29 de Jul. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by