フィルターのクリア

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 件のコメント
Sansit Das
Sansit Das 2019 年 10 月 23 日
Thank you Daniel for your answer. This would really help me in running my codes. Thanks a lot.

サインインしてコメントする。

その他の回答 (1 件)

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by