How does MATLAB know it ran from vscode or desktop?
Afficher commentaires plus anciens
I am setting up a startup.m script.
I want to implement different behavier in this script depending on the starting mode of MATLAB.
For example, If MATLAB is ran from double clik on desktop, the startup.m executes code_1, while if MATLAB is started by vscode official extension, the startup.m executes code_2.
Are there anyone know how to distinguish the two different starting mode by MATLAB itself?
Réponse acceptée
Plus de réponses (1)
Pratyush
le 24 Nov 2023
0 votes
Hi Lala,
Since Visual Studio Code extension does not support execution or debugging of MATLAB code (refer to this MATLAB Blog to know the limitations of the extension: https://blogs.mathworks.com/matlab/2023/04/26/do-you-use-visual-studio-code-matlab-is-now-there-too/#:~:text=What%E2%80%99s%20missing%20from%20this%20version%20of%20the%20extension%3F), I understand that different starting mode means, you want to distinguish if the MATLAB program is running in a MATLAB session mode (i.e. in the MATLAB IDE) or as a stand alone program (i.e. compiled using MATLAB compiler).
You can use the function "isdeployed" which returns logical 1 (true) when the function is running in deployed mode using MATLAB® Runtime and 0 (false) if it is running in a MATLAB session. You can refer to the following documentation for more details: https://in.mathworks.com/help/compiler/isdeployed.html
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
