Related Questions

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

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 Commented on by Mario on 17 Feb 2014

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.

0 Comments

MathWorks Support Team

Tags

No tags are associated with this question.

Products

1 Answer

Answer by MathWorks Support Team on 18 Oct 2013
Accepted answer

There are a few reasons why MATLAB can hang at initializing.

If you are using R2011a on a computer with 32 or more cores, please see the following bug report http://www.mathworks.com/support/bugreports/732450

Licensing issues:

===== OPTION 1 =====

If MATLAB starts, but remains in the "Initializing" state, MATLAB may be searching for additional licenses on your system.

This may be caused by an environment variable named LM_LICENSE_FILE. This variable tells MATLAB and other flexlm applications where to find the license file. MATLAB may also hang if you have a network license for some features and you disconnect from the network.

NOTE: There may also be an MLM_LICENSE_FILE variable as the root of this issue. This variable works only for MATLAB.

To fix this problem, you can do the following:

=======

Windows

=======

1) Right-click on the "My Computer" icon and go to "Properties". (You may also do this by going to the Control Panel and double clicking "System."

2) Go to the "Advanced" tab and click on "Environment Variables"

3) Under the bottom window, System variables, look for a variable named LM_LICENSE_FILE

4) If there is an LM_LICENSE_FILE variable already set, skip to step 5. If there is not, create an LM_LICENSE_FILE variable by clicking "New" and typing "LM_LICENSE_FILE" in the Variable name box.

5) Set the LM_LICENSE_FILE variable to the absolute path of the license file for MATLAB. If you are not sure where that file is located, see the related solution: "Where are the license files for MATLAB located?" linked below. If there is more than one license file, put a semi-colon (;) after the first path, then type the path to the next license file. Click "OK" to save.

6) Launch MATLAB again.

==============

Unix, Linux, or Mac

==============

1) Check to see if there is an environment variable set. Where this is located depends on the shell you are using. Look in your home folder. This file may be called: .cshrc (c-shell), .profile (bash), or .bashrc (bash)

2) You can also create an environment variable for that shell session from the command line using export or setenv (depending on your shell), but the above file needs to be edited for a permanent change.

For example:

 

export MLM_LICENSE_FILE /usr/bin/matlab/license.dat

===== OPTION 2 =====

Alternatively, if you use only one license to access MATLAB and toolboxes, you can specify the license file in the MATLAB shortcut or from the command line when launching MATLAB. To do so, follow these steps:

=======

Windows

=======

1) Right-click on a shortcut to MATLAB and select "Properties"

2) In the "Target" field, enter the following:

"$MATLAB\bin\win32\MATLAB.exe" -c "<Full Path to the MATLAB license file including file name>”

Where $MATLAB is the root MATLAB directory and <Path to the MATLAB license file> is the absolute path to your license file. If you are not sure where this is located, see the related Article:

Where are the license files for MATLAB located?

http://www.mathworks.com/matlabcentral/answers/99147

3) Click "OK".

4) Launch MATLAB from the shortcut.

=================

For Linux, Unix, or Mac

=================

1) Use a -c switch to point directly at the license file when launching.

2) If the MATLAB installer has created symbolic links, run

 

matlab -c <Full Path to the MATLAB license file including file name>

3) If symbolic links were not created, run from $MATLAB/bin/

 

./matlab -c <Full Path to the MATLAB license file including file name>

Where $MATLAB is the root MATLAB directory and <Path to the MATLAB license file> is the absolute path to your license file, likely in your $MATLAB/licenses directory.

Non-licensing issues:

===== SOLUTION 1 =====

Recreate MATLAB preferences by doing the following:

==========

On Windows

==========

(Make sure you have enabled viewing of hidden files and folders first)

1) Quit MATLAB. Ensure that MATLAB is no longer running.

2) Browse to the folder c:\Documents and Settings\ <your username>\Application Data\MathWorks\MATLAB\ OR c:\users\<username>\AppData\Roaming

3) Rename the directory named after the version of MATLAB you are using to have _old at the end. If there is a folder with "_licenses" in the name, DO NOT rename that folder.

4) Once this has been removed, restart MATLAB. This directory will be recreated the next time you start MATLAB.

If that does not resolve the issue, there is a known issue with MATLAB 7.0 (R14) on Windows and the graphics libraries supplied with certain graphics cards, which do not use memory efficiently, and cause MATLAB 7.0 (R14) to use virtual memory more frequently than would be expected. In this case, disabling the hardware graphics acceleration features of the card may improve the performance of MATLAB 7.0 (R14). To do so, follow the steps below.

1) Close MATLAB.

2) Right-click on the Windows desktop, and select "Properties".

3) In the Display Properties window that opens, select the "Settings" tab, and then click on the "Advanced" button.

4) In the window which opens, select the "Troubleshoot" tab.

5) Set the "Hardware acceleration" slider all the way to the left, to "None".

6) Click "OK" in this window, and then click OK again in the Display Properties window.

7) Restart MATLAB.

=================

On Linux, Unix, or Mac

=================

1) Quit MATLAB. Ensure that MATLAB is no longer running.

2) Go to the ".matlab/" directory in the users home directory. Rename the directory named after the version of MATLAB you are using to have _old at the end. If there is a folder with "_licenses" in the name, DO NOT rename that folder

3) Restart MATLAB.

===== 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 =====

If you have MATLAB R2007a, there is a bug that prevents MATLAB from starting. For more information about that bug, see the bug report here:

http://www.mathworks.com/support/bugreports/details.html?rp=366601

===== SOLUTION 4 =====

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, following command executes successfully:

 

>> uiputfile({'*.*','All Files (*.*)'}, 'Save As',fullfile(pwd,'a 1/20'))    

But following command keeps MATLAB busy:

 

>>  uiputfile({'*.*','All Files (*.*)'}, 'Save As',fullfile(pwd,'a 1<20'))

===== SOLUTION 5 =====

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. 

If none of these solutions resolved your performance concerns, or if you have a concern with the performance of a specific feature, contact Technical Support for assistance.

 

1 Comment

Mario on 17 Feb 2014

Hi, I tried all your solutions and solution one worked fine (Recreate MATLAB preferences), for a day or so. Today I started Matlab and it got stuck again on the command window preventing me from writing any command, basically the cursor disappeared.

What can I do in this case?

Thanks in advance

MathWorks Support Team

Contact us