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

조회 수: 1,330 (최근 30일)
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.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2023년 6월 7일
편집: MathWorks Support Team 2023년 6월 7일
When MATLAB opens with "Initializing" or "Busy" for an extended period of time, the MATLAB installation may be experiencing a licensing issue.  This article will go provide information on:
  • Is this a licensing issue?
  • Licensing solutions
  • Non-licensing solutions
Is this a licensing issue?
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, 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 solutions”.
Licensing solutions
Licensing issues may be caused by bad entries on the license search path, such as non-resolvable hostnames and 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:
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.

1. Determine the problematic license file or environment variable.

Once MATLAB has started run a license checkout test to determine which license file is problematic. 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).

2. 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 solutions

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:

Solution 2

Similar to the preferences folder, the following MATLAB folder may cause this issue:
C:\Users\%username%\AppData\Local\MathWorks\MATLAB\R2XXXx
To resolve, rename or delete the R2XXXx folder, then create a new R2XXXx.
Note: The R2XXXx corresponds to the release of MATLAB.

Solution 3

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.
In particular, Kaspersky Endpoint Security 10 for Windows 10.2.5.3201 (MR3.pf1800)  has been found to slow MATLAB startup. Updating it to version 10.3.0.6294 has helped customers resolve this.

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, 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 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.
MATLAB startup will be excessively slow if there are too many files added to the MATLAB path. Adding thousands of files to the MATLAB path is rarely necessary, because you can always reference files using their absolute path even if they are not included on the MATLAB path. 
Try taking a backup of the MATLAB path, then restore the default path as described in this article and test whether MATLAB startup speed is improved:
How will running the "restoredefaultpath" and "savepath" commands affect my custom paths and how do I back up my custom paths?

Solution 6

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 7

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.
 

Solution 8

If your Operating System such as Windows, Linux, or MacOS has recently updated, make sure that the update(s) successfully installed and complete any other updates that need to be installed.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by