How does MATLAB know it ran from vscode or desktop?
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (1)
Pratyush
el 24 de Nov. de 2023
0 votos
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
1 comentario
lala
el 24 de Nov. de 2023
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
