Is it possible to programmatically check whether MATLAB has been started with the "-sd" option?
Ältere Kommentare anzeigen
I have a program that needs to behave differently depending on whether MATLAB was started with the "-sd" option (sets initial working folder) or not. However, I cannot determine a way to programmatically check this.
4 Kommentare
dpb
am 17 Sep. 2022
Describe this start scenario in more detail -- what is starting the session and where is the option/command being set?
Walter Roberson
am 17 Sep. 2022
Suppose that the option were used, but the folder named was the same as the folder that would otherwise have been used. Do you need to detect that case?
Is the real concern whether the option was provided, or is the real concern whether the current directory is not the same as the default userpath(), or is the real concern whether some configuration needs to be redone (such as loading in data)?
Andre Zeug
am 18 Sep. 2022
dpb
am 18 Sep. 2022
TMW hasn't provided a link to the command line -- I see a couple alternatives...(I've not tried either, just possible approaches that come to mind at the moment).
- Use a batch file containing the startup command and have it set an environment variable that startup.m can check, or
- Write a mex command that returns the command line and use the -r option to dispatch it. I don't know that this will work or not...
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu MATLAB Coder finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!