Slow first MATLAB start

8 views (last 30 days)
Andrei
Andrei on 24 Mar 2025
While creating Azure Windows image for MATLABs we noticed it works very slow during the first call.
To make it work faster we added the execution of the code below before packer created image:
$matlabCommand = "-batch `"version, ver -support, pause(10), exit`""
$matlab_dirs = Get-ChildItem -Path "C:\Program Files\MATLAB\R*" # find all matlab versions
foreach ($matlab_dir in $matlab_dirs) {
$matlabPath = "$matlab_dir\bin\matlab.exe" # This is where the executable is
if (Test-Path $matlabPath) {
Write-Host "Initializing $matlab_dir"
cmd /c "`"$matlabPath`" $matlabCommand"
}
MATLAB started to work faster but still slow comparing to the second run on the same Azure machine.
What could be done to make it work faster?
we use MATLAB installer so MATLAB Startup Accelerator task is present on the machine.
I saw WarmUp-MATLAB.ps1 it should work as Startup Accelerator as it uses the same binary.
P.S. we spin up the Azure machine only for 1 build so we are looking for any solution which could be adopted by packer.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!