
Launching code from MS scheduler...code starts before initialization has finished
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I launch some Matlab code from MS scheduler at a given time, and it starts the script before Matlab initilaization has finished. Is there any way of ensuring the initalization is finished before the code is run?
0 comentarios
Respuestas (1)
Pratyush Swain
el 3 de En. de 2025
Hi David,
I am assuming here by MATLAB initialization, you are referring to the loading up of the MATLAB GUI. If your script is running before MATLAB initialization has finished, you can consider the following workarounds:
1.If your script does not require loading up of MATLAB, consider running script in a non interactive manner using batch processing.This can help manage initialization overhead and ensure script is run in separate session.
To perform this in the Microsoft Task Scheduler, under the 'Actions' tab set the program to MATLAB exceutable file and under arguments add: batch "run('path\to\your_script.m')".
Please refer to the snapshot below:

2. You can add a delay at the beginning of your main script which might allow MATLAB to initialize completely before executing the rest of the script.
% ----- script/code file ----- %
pause(5); % Wait for 5 seconds
% ----- Rest of your script --- %
Hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!