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

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!

 Accepted Answer

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 Comment

Thank you Daniel for your answer. This would really help me in running my codes. Thanks a lot.

Sign in to comment.

Categories

Asked:

on 23 Oct 2019

Commented:

on 23 Oct 2019

Community Treasure Hunt

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

Start Hunting!