MATLAB Answers

2

Why does MATLAB get stuck in the "Initializing" or "Busy" state or take a long time to start?

Asked by MathWorks Support Team on 19 Jul 2013
Latest activity Answered by Jim Riggs
on 16 Nov 2018 at 17:46
MATLAB opens but the status states 'Initializing' or 'Busy' for a long time. MATLAB takes a long time to launch with or without a remote license manager.
 

Tags

No tags entered yet.

Products

10 Answers

Answer by MathWorks Support Team on 26 Jul 2017
Edited by MathWorks Support Team on 26 Jul 2017
 Accepted Answer

To determine whether a slow startup is a licensing issue or not please attempt to start MATLAB using the “-c” startup flag. To launch MATLAB with a startup flag please open a command prompt/terminal window and enter the path to the MATLAB executable, the “-c” flag a, and finally the path to a known working license file. See the following examples:
*Windows: *
"$MATLAB\bin\win64\MATLAB.exe" -c <full_path_to_license_file or port@host>
*Linux or Mac: *
./matlab -c <full_path_to_license_file or port@host>
Note: If symbolic links were not created, run from $MATLAB/bin/
Where $MATLAB is the root MATLAB directory
If this resolves the issue, then a licensing problem is the root cause. If this does not resolve the problem, please scroll further down for “Non-licensing issues”.
Licensing issues
Licensing issues may be caused by bad entries, such as non-resolvable hostnames, on the license search path, most commonly within an environment variable named LM_LICENSE_FILE or MLM_LICENSE_FILE. These variables tell MATLAB and other FlexNet applications where to find the license file.
For additional information about environment variables and how they are set please refer to the following article:
What are the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables and how do I set or check for them?
MATLAB can experience a long delay as it attempts to communicate with these other computers or license servers. License servers listed that can be communicated with but do not have a license manager running can potentially cause this issue as well. Additionally, if you have borrowed a license and then left the network where the license was borrowed from, MATLAB startup may also be delayed.
Follow the below steps to resolve the issue.
  • Determine the problematic license file or environment variable.
Once MATLAB has started run a license checkout test to determine which license file is problematic (R2017a):
In R2017a the following commands will list the license paths it has found and how long it spent trying a checkout:
matlab.internal.licensing.pathTest % (This will test MATLAB’s current license search path)
matlab.internal.licensing.pathTest(pathToTest) % (This will test a specific license search path)
Note that an individual license will give “No MATLAB Feature exists on the path” despite MATLAB successfully checking out from this license. A network license will not provide this error.
For releases prior to R2017a some trial and error is required to determine the exact license file or environment variable that is causing the delay. Please run the following command to see the entire search path that MATLAB utilizes to find license files:
>> feature lmsearchpath
Once you have determined all the license files in the search path try removing suspected bad license entries (i.e. network licenses).
  • Remove the offending license file or work w/ local IT to resolve network issues.
Any license files or environment variables that is pointed towards a network location that is no longer accessible should be removed.
If Instead the license is pointed towards a network location that is accessible, but is the cause of the delayed startup please work with your local IT department to determine the source of the issue. In many cases security software or restrictive IT policies may be the culprit.
Non-licensing issues:
Solution 1
Often a corrupt preferences directory can prevent MATLAB from starting correctly. Please attempt to recreate the MATLAB preferences directory, the instructions are available in the following article:
How do I regenerate my MATLAB preferences?
Solution 2
In some instances, customers have reported that the anti-virus application which was working in the background, was slowing down MATLAB. For these customers, disabling the “active scan’ option for at least the MATLAB directories improved performance substantially.
Solution 3
In some cases, when you put an invalid character in the filename while saving a file, this issue may arise.
However, some invalid characters like /, \ , present in filename does not hang MATLAB, while other characters does (<,>,”,|,:).
For example, the following command executes successfully:
uiputfile({'*.*','All Files (.)'}, 'Save As',fullfile(pwd,'a 1/20'))
But the following command keeps MATLAB busy:
uiputfile({'*.*','All Files (.)'}, 'Save As',fullfile(pwd,'a 1<20'))
Solution 4
MATLAB might be attempting to access files from a sluggish network. Check output of “path” to ensure that all the directories are local. Remove any network drives to see if there is any improvement.
Solution 5
In some rare cases the preference settings in MATLAB may negatively affect startup performance. The following steps ensure the toolbox cache settings are set back to the default:
  1. In the MATLAB toolstrip, click on “Home” and then on the “Preferences” button.
  2. Inside the “Preferences” window, select “MATLAB -> General” on the left-hand side.
  3. On the right-hand side, verify that “Enable toolbox path cache” is enabled.
Another possible preference that may negatively affect startup performance is the source-control integration. Please attempt to disable this setting if you do not use any form of source-control integration.
  1. In the MATLAB toolstrip, click on “Home” and then on the “Preferences” button.
  2. Inside the “Preferences” window, select “MATLAB -> General -> Source Control”. on the left-hand side.
  3. Select “None” on the right-hand side and then apply the changes.
Solution 6
If none of the above solutions resolve the issue the “timing” flag can be used as a diagnostic tool that will help determine which process is taking a long time to initialize. To do this, you can run MATLAB from command prompt or terminal by navigating to the bin directory like so:
cd $MATLAB\R20XXx\bin
Where $MATLAB is the root MATLAB directory
Next execute the following command:
matlab -timing
This will start MATLAB and automatically record the time taken for each startup task. When the startup completes, you will see a log outputted inside the MATLAB Command window that summarizes the timing results. Note that this will also create a text log file noted at the top of the output.

  9 Comments

matlab -c "/Users/Cate/Library/Application Support/MathWorks/MATLAB/R2017a_licenses/license_Catherines-MacBook-Pro-2_650541_R2017a.lic"
I encountered this issue, and found that using a VPN can interfere with the licence verification process. If you're using a VPN, disable it temporarily when you start up MATLAB - you can re-enable it afterwards.
If all else fails try disconnecting from the internet before launching MATLAB. After MATLAB shows a status of " Ready", you can go online again.It is the only thing that worked for me.

Sign in to comment.


Answer by Kouichi on 26 May 2016

I had been using MATLAB with network licence. In my Mac, the license file xxxx.lic is stored in Applications/MATLAB_R2015b.app/licenses/.
I recently moved to another institution, and hence the licence has been changed. I used Applications/MATLAB_R2015b.app/Activate.app to change the licence. It was successful, but since then launching became extremely slow.
I tried a method mentioned above and renamed .matlab/R2015b folder to .matlab/R2015b_old, but did not help.
I looked at /Applications/MATLAB_R2015b.app/licenses again and noticed that now this folder contains two ~.lic files. So I deleted the older xxxx.lic file, and that was it.
It seems that if the /Applications/MATLAB_R2015b.app/licenses folder contains two conflicting license files MATLAB cannot decide which one to comply and takes a long time to be initialized.

  1 Comment

I installed Matlab 2016b on ubuntu 16.04 and it hangs in the start-up. When I run it with sudo ./matlab it runs fine. Finally I use the command sudo chown your_user_name -R ~/.matlab. Now it works.

Sign in to comment.


Answer by chart
on 3 Aug 2017
Edited by chart
on 3 Aug 2017

I also have this issue, but I am unable to complete many of the steps outlined above because I cannot access the MATLAB prompt (>>). The prompt never appears because the application state is always "Initializing...".
I have tried restarting the application, restarting my computer, recreating my preferences and even reinstalling the application, but the problem has persisted.
I have ensured that the MLM_LICENSE_FILE environment variable to indicate the appropriate server. I can successfully launch the application and get to the "Initializing..." state with both
"$MATLAB\bin\win64\MATLAB.exe" -c < port@host > (appropriate values replaced for my organization)
and
matlab.exe -timing
but because the application never finishes its initialization no log is produced to help me troubleshoot what is wrong.
I know that the licensing was properly configured during the first installation because the application behaved normally for a time after installation including access to several toolboxes.
If there are any other steps that I can try, particularly those which I am able to access without requiring a MATLAB prompt, the help is much appreciated.
Thank you.

  5 Comments

Do you solve it? Matlab run perfectly until this morning before one actualization of Windows 10. Now all time is inicializating or busy...
hi, did you find any solution? It happened the same thing a few days ago with the windows update...
Are you trying to perform symbolic calculations? If so see this Answer.

Sign in to comment.


Answer by AJC
on 17 Oct 2017
Edited by Walter Roberson
on 17 Oct 2017

same issues here. Timer doesn't tell me much apart from "something" is causing a long delay. The license files seem OK too. No clue what the 4 min delay is all about? See longs below:
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
* 0.00 0.00 0.00 MATLAB script
* 0.15 0.15 0.00 main
* 0.41 0.26 0.00 Session Initialize
* 0.57 0.02 0.14 LM Startup
* 0.63 0.00 0.06 splash
* 1.15 0.13 0.38 Constant Initialization
* 1.80 0.65 0.01 InitSunVM
* 2.76 0.92 0.03 PostVMInit
* 2.76 1.60 0.01 mljInit
* 7.06 4.27 0.02 StartDesktop
* 7.06 5.90 0.01 Java initialization
* 7.17 0.00 0.11 psParser
* 7.23 0.04 0.01 cachepath
* 8.48 1.16 0.10 matlabpath
* 8.53 0.00 0.06 SettingsConstructorLoadingFiles
* 8.53 0.01 0.05 SettingsConstructorLoadingFiles
* 9.27 2.04 0.00 matlabrc
* 10.15 3.10 7.06 Init Desktop
* 223.08 216.02 7.06 Ready
=========================================================
Items shown account for 100.7% of total startup time [TIMER: 2 MHz]
Determining checkout time for MATLAB.
MATLAB's license search path is :
C:\Users\acollins\AppData\Roaming\MathWorks\MATLAB\R2017b_licenses\license_XIRACOLLINS31_399358_R2017b.lic;C:\Program Files\MATLAB\R2017b\licenses\license.dat;C:\Program Files\MATLAB\R2017b\licenses\*.lic
C:\Users\acollins\AppData\Roaming\MathWorks\MATLAB\R2017b_licenses\license_XIRACOLLINS31_399358_R2017b.lic
Checkout time 8 milliseconds. No MATLAB feature exists on the path (status -8)
C:\Program Files\MATLAB\R2017b\licenses\license.dat
No License File exists on this path.
C:\Program Files\MATLAB\R2017b\licenses\*.lic
No License File exists on this path.
>>

  2 Comments

I keep getting a slow start even though I tried every one of the steps given.
Toolbox Path Cache read in 0.05 seconds.
MATLAB Path initialized in 1.12 seconds.
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.06 0.06 0.00 main
0.48 0.42 0.00 Session Initialize
0.62 0.02 0.11 LM Startup
0.68 0.00 0.06 splash
1.14 0.18 0.28 Constant Initialization
1.58 0.43 0.01 InitSunVM
2.35 0.74 0.03 PostVMInit
2.35 1.20 0.01 mljInit
3.00 0.62 0.03 StartDesktop
3.00 1.84 0.01 Java initialization
3.12 0.00 0.12 psParser
3.17 0.05 0.01 cachepath
4.38 1.12 0.08 matlabpath
4.44 0.00 0.06 SettingsConstructorLoadingFiles
4.44 0.01 0.05 SettingsConstructorLoadingFiles
5.04 1.87 0.00 matlabrc
5.47 2.47 3.00 Init Desktop
37.46 34.46 3.00 Ready
=========================================================
Items shown account for 103.9% of total startup time [TIMER: 2 MHz]
Determining checkout time for MATLAB.
MATLAB's license search path is :
C:\Program Files\MATLAB\R2017b\licenses\license.lic;C:\Users\Ashween\AppData\Roaming\MathWorks\MATLAB\R2017b_licenses\license_RAZOR_678256_R2017b.lic;C:\Program Files\MATLAB\R2017b\licenses\license.dat
C:\Program Files\MATLAB\R2017b\licenses\license.lic
Checkout time 14 milliseconds. No MATLAB feature exists on the path (status -8)
C:\Users\Ashween\AppData\Roaming\MathWorks\MATLAB\R2017b_licenses\license_RAZOR_678256_R2017b.lic
Checkout time 14 milliseconds. No MATLAB feature exists on the path (status -8)
C:\Program Files\MATLAB\R2017b\licenses\license.dat
No License File exists on this path.
I did the same thing,but after I disconnected from the internet. It opened much quicker. So disconnecting before launch and reconnecting "works".
Toolbox Path Cache read in 0.05 seconds.
MATLAB Path initialized in 1.07 seconds.
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.06 0.06 0.00 main
0.51 0.45 0.00 Session Initialize
0.66 0.03 0.12 LM Startup
0.76 0.00 0.10 splash
1.25 0.17 0.32 Constant Initialization
1.69 0.43 0.02 InitSunVM
2.44 0.71 0.03 PostVMInit
2.44 1.17 0.02 mljInit
3.06 0.60 0.03 StartDesktop
3.06 1.79 0.02 Java initialization
3.17 0.00 0.11 psParser
3.23 0.05 0.01 cachepath
4.38 1.07 0.08 matlabpath
4.44 0.00 0.06 SettingsConstructorLoadingFiles
4.44 0.01 0.06 SettingsConstructorLoadingFiles
5.01 1.78 0.00 matlabrc
5.52 2.47 3.06 Init Desktop
7.39 4.33 3.06 Ready
=========================================================
Items shown account for 117.2% of total startup time [TIMER: 2 MHz]
When I checked for my licences, this was the result;
>> matlab.internal.licensing.pathTest
Determining checkout time for MATLAB.
MATLAB's license search path is :
C:\Program Files\MATLAB\R2017b\licenses\license.lic;C:\Users\Ashween\AppData\Roaming\MathWorks\MATLAB\R2017b_licenses\license_RAZOR_678256_R2017b.lic;C:\Program Files\MATLAB\R2017b\licenses\license.dat
C:\Program Files\MATLAB\R2017b\licenses\license.lic
Checkout time 15 milliseconds. No MATLAB feature exists on the path (status -8)
C:\Users\Ashween\AppData\Roaming\MathWorks\MATLAB\R2017b_licenses\license_RAZOR_678256_R2017b.lic
Checkout time 14 milliseconds. No MATLAB feature exists on the path (status -8)
C:\Program Files\MATLAB\R2017b\licenses\license.dat
No License File exists on this path.

Sign in to comment.


Answer by Moulai Sidi Mohammed on 23 Oct 2017

just found the solution, u have to add a system variable LM_LICENSE_FILE with value address of the license file in your system and then restart. right click on win button > system > advanced system setting >environment values
add the variable as said above in the system variables .

  4 Comments

Show 1 older comment
On my 2017b install I have exactly the same problem. It takes 4min 20s to startup, mainly due to this Ready stage.
My 2017a install takes 13s to start-up so something has changed in this stage in between these 2 versions.
If all else fails try disconnecting from the internet before launching MATLAB. After MATLAB shows a status of "Ready", you can go online again.It is the only thing that worked for me.

Sign in to comment.


Answer by John Anderson on 21 Apr 2018

One other approach I have found to be effective is to

  • Deactivate Matlab
  • Browse to the licensing folder : C:\Program Files\MATLAB\R2017b\licenses
  • Delete the contents of this folder
  • Reactivate Matlab

I appeared to have some legacy licensing files that even though I had performed a clean install of Matlab 2017b were still hanging around. My initialization is reduced from 20mins+ to 20 seconds.

  0 Comments

Sign in to comment.


Answer by Jim Riggs
on 16 Nov 2018 at 17:46

I also recently encountered this problem, but in my case the soltion was different.
I am running 2016b. I went to save some large data structures into a file, but in my save command I inadvertently specified a .m file type. It apears that Matlab immediately interpreted this file as a script and attempted to read it, and became locked up. When I closed Matlab and attemped to restart the program, it became locked up with the status "initializing". After Two days of fiddling around, I discovered that when this errant file is removed from the Matab folder, Matlab starts and runs just fine. As soon as the offending file is copied back into the Matlab folder, Matlab crashes, even if it is just sitting idle.

  0 Comments

Sign in to comment.



I tried everything here and nothing worked for the 2016a version. I experimented with my path and realized one entry generates the delay. I spent 3 hours trying to identify the culprit but it turned out these were 3. Three folders created the problem a delay of 1 minute. In these folders i had 70,000 mat files. It seems in the initialization process these (maybe their names) are scanned and this caused the delay for me. Now initialization takes 2 seconds. I hope someone will find this useful.

  0 Comments

Sign in to comment.


Answer by salma taik on 9 Aug 2018

hi guys if someone is still having this problem i guess i kinda found a solution that worked for me. i struggled the whole day with it i tried what is mentioned above and nothing worked. It happened that i deleted the temporary files in the laptop and it worked just fine.

  1 Comment

Hi, perhaps you need install the R2018a_update. I have the same problem when windows 10 was updated. Best

Sign in to comment.


Answer by Philipp stenzel on 11 Sep 2018

Hello, I also got this problem with my MATLAB Version 2017b,and no solution is working for me. Can maybe please someone help me.
I only get the normal start-up, if I turn off my internet, after he found the licenses. But I don't think that this is a normal start for this software.
if true
%
%
MATLAB Startup Performance Metrics (In Seconds)
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.21 0.21 0.00 main
0.87 0.66 -0.00 Session Initialize
6.63 5.62 0.14 LM Startup
6.69 0.00 0.06 splash
7.36 0.18 0.49 Constant Initialization
8.91 1.53 0.01 InitSunVM
10.00 1.06 0.03 PostVMInit
10.00 2.62 0.01 mljInit
16.06 6.04 0.02 StartDesktop
16.06 8.68 0.01 Java initialization
16.08 0.00 0.02 psParser
17.17 0.08 1.01 cachepath
19.39 2.11 0.12 matlabpath
19.71 3.65 16.06 Init Desktop
66.86 0.00 47.46 SettingsConstructorLoadingFiles
66.86 0.01 47.46 SettingsConstructorLoadingFiles
67.66 50.49 0.00 matlabrc
269.41 253.35 16.06 Ready
=========================================================
Items shown account for 118.5% of total startup time [TIMER: 2 MHz]
%
%
% Start and turn Internet off
%
total item gap description
=========================================================
0.00 0.00 0.00 MATLAB script
0.19 0.19 0.00 main
0.81 0.62 0.00 Session Initialize
6.86 5.91 0.14 LM Startup
6.93 0.00 0.07 splash
7.53 0.17 0.43 Constant Initialization
9.15 1.61 0.02 InitSunVM
10.32 1.14 0.03 PostVMInit
10.32 2.77 0.02 mljInit
21.17 10.82 0.03 StartDesktop
21.17 13.62 0.02 Java initialization
21.19 0.00 0.01 psParser
21.29 0.10 0.01 cachepath
23.44 2.03 0.12 matlabpath
23.57 0.00 0.13 SettingsConstructorLoadingFiles
23.57 0.01 0.13 SettingsConstructorLoadingFiles
23.92 2.75 21.17 Init Desktop
24.35 3.05 0.00 matlabrc
26.77 5.60 21.17 Ready
=========================================================
Items shown account for 109.3% of total startup time [TIMER: 2 MHz]
end

  0 Comments

Sign in to comment.