
Launching code from MS scheduler...code starts before initialization has finished
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Pratyush Swain
il 3 Gen 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 Commenti
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!