If matlab -desktop elseif matlab -nodesktop

11 次查看(过去 30 天)
How i can check if my scripts/functions running with gui matlab or not? something like this:
if "matlab -desktop"
%
else
%
end

采纳的回答

Jan
Jan 2018-6-23
  3 个评论
Edward
Edward 2020-7-27
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 2020-7-29
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by