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