What is the best way to have easy available settings for a MATLAB toolchain

1 回表示 (過去 30 日間)
Andreas Nord
Andreas Nord 2021 年 3 月 8 日
回答済み: Shiva Kalyan Diwakaruni 2021 年 3 月 11 日
Hi!
I have a sizeable toolchain in MATLAB which is run with some settings, currently defined in a static class that is on the MATLAB path.
I want to change these settings depending on the environment it's running on (for example local vs cluster).
I don't want to have to pass some boolean like 'isCluster' to each function because of how deeply nested the functions are.
Would it be a good idea to initialize a global instance of the settings class in the main script, something like:
global settings = SettingsClass(isCluster)
which would then be accesible everywhere, or is this a risky pattern? Any good suggestions are welcome!

回答 (1 件)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni 2021 年 3 月 11 日
Hi,
You can try typing "matlab -help" or "matlab -h" in your command prompt and it will show list of startup flags , there is a specific startup flag '-r' to which you can pass matlab command , which Start MATLAB and execute the MATLAB_command.
You can also follow the below link where user tries change priorty by changing settings in a file inside matlabroot directory using start command
hope it helps,
thanks

カテゴリ

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