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

1 visualización (últimos 30 días)
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

Daniel M
Daniel M el 23 de Oct. de 2019
Editada: Daniel M el 23 de Oct. de 2019
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:

Más respuestas (1)

Bjorn Gustavsson
Bjorn Gustavsson el 23 de Oct. de 2019
Have a look at the commands: computer, ispc, insunix, ismac.
HTH

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by