A switch case statement that will help me to either run codeS in Windows or linux, based on whichever OS it is

1 次查看(过去 30 天)
I want to write a switch case statement that will help me to either run my code in Windows or linux, based on whichever OS it is. Any Suggestions!

采纳的回答

Daniel M
Daniel M 2019-10-23
编辑:Daniel M 2019-10-23
if ismac
% Code to run on Mac platform
elseif isunix
% Code to run on Linux platform
elseif ispc
% Code to run on Windows platform
else
disp('Platform not supported')
end
And you can easily adapt that to a switch if you like.
Taken from this page:

更多回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2019-10-23
Have a look at the commands: computer, ispc, insunix, ismac.
HTH

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by