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!

 Respuesta aceptada

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 comentario

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

Iniciar sesión para comentar.

Más respuestas (1)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Oct. de 2019

Comentada:

el 23 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by