License issue in MATLAB?
Show older comments
I'm trying to fix a long launching time of my MATLAB/R2022a based on Why does MATLAB get stuck in the "Initializing" or "Busy" state or take a long time to start? - MATLAB Answers - MATLAB Central (mathworks.com). However, I even get errors in the very initial steps.
1. Checking if it is a licensing issue.
I tried to start MATLAB using "-c" startup, but failed. Below is the command I ran on command prompt on my Windows computer:
"$MATLAB\bin\win64\MATLAB.exe" - c C:\Users\Daigo\AppData\Roaming\MathWorks\MATLAB\R2022a_licenses\license_XXX.lic
I get "The system cannot find the path specified." error. I'm pretty sure the license is in the absolute path I'm specifiying, but it's not recognized.
2. Determining the problematic license.
I also ran the licesing test on MATLAB terminal by running
matlab.internal.licensing.pathTest
which gave me:
Determining checkout time for MATLAB.
MATLAB's license search path is :
C:\Users\Daigo\AppData\Roaming\MathWorks\MATLAB\R2022a_licenses\license_XXX.lic;C:\Program Files\MATLAB\R2022a\licenses\license.dat;C:\Program Files\MATLAB\R2022a\licenses
C:\Users\Daigo\AppData\Roaming\MathWorks\MATLAB\R2022a_licenses\license_XXX.lic
Checkout time 13 milliseconds. No MATLAB Feature exists on the path (status -8)
C:\Program Files\MATLAB\R2022a\licenses\license.dat
No License File exists on this path.
C:\Program Files\MATLAB\R2022a\licenses
No License File exists on this path.
Apparently, there are some problems in the license or environment variable. I'm not so sure what "No MATLAB Feature exists on the path" means. Regarding the last two lines, I confirmed that "C:\Program Files\MATLAB\R2022a\licenses" didn't exist.
Does anyone have advice on how to fix this problem?
7 Comments
Daigo
on 14 Sep 2023
Walter Roberson
on 14 Sep 2023
"$MATLAB\bin\win64\MATLAB.exe"
Is command.com (or Powershell) able to recognize and do something sensible with the $MATLAB part of a double-quoted string? Could the path error potentially be about not being able to find the executable?
Good eyes, Walter! I just told OP to check w/ TMW as rote response for license file issues...but that does look like bum syntax although I made another presumption that if it didn't work correctly, the response would have been that the .exe or path couldn't be found--that may also have been too much of an assumption for powershell, but I don't think it can work with the CMD command interpreter...
C:\Users\owner>set $MATLAB=C:\ML_R2021b
C:\Users\owner>echo %$MATLAB
%$MATLAB
C:\Users\owner>echo %$MATLAB%
C:\ML_R2021b
C:\Users\owner>$MATLAB\bin\win64\MATLAB.exe
The system cannot find the path specified.
But
C:\Users\owner>%$MATLAB%\bin\win64\MATLAB.exe
launches MATLAB -- the above is with CMD.
I haven't used powershell enough to have an adeptness with it at all -- it's just so terribly convoluted to do anything in you can't do anything without finding a template somewhere already that does it; the documentation is totally opaque it seems. Anyway, ranting about MS aside,
Well, it's a struggle I've not yet won -- I figured out how to set the MATLAB environment variable (although it won't accept the $ sign as a valid variable name), but so far I've not figured out how to use it.
However, I did find the following tidbit that's interesting--
"In PowerShell, you can define a string with single or double quotes. There is a difference between these two methods. In a single-quoted string, variables and subexpressions are not expanded, whereas, in a double-quoted string, they are expanded."
If that is what the OP is somehow doing and knows enough that the $ sign is somehow significant in here, too, it may just be why the double quotes are there. But,
PS C:\Users\owner> dir env:M*
Name Value
---- -----
MATLAB C:\ML_R2021b
PS C:\Users\owner>
did set the environment variable to existing local path.
Trying to use it not so successful...I've not found anything yet useful that illustrates how to use them now.
PS C:\Users\owner> "MATLAB\bin\win64\MATLAB.exe"
MATLAB\bin\win64\MATLAB.exe
PS C:\Users\owner>
The double-quoted version that was according to the above supposed to expand it didn't do anything but echo back the name string.
PS C:\Users\owner> "$MATLAB\bin\win64\MATLAB.exe"
\bin\win64\MATLAB.exe
PS C:\Users\owner>
The dollar sign inserted as OP has it seems to mean something to PS; the name is the highlighted in green instead of the default text color but I have no idea what that means; it didn't do anything with it when execute the command.
All other perturbations I could think of are similarly unsuccessful.
Whoever dreamed up powershell was off in never-never land...I'm sure there must be a way, but it is the most convoluted and arcane thing I've ever seen.
Walter Roberson
on 14 Sep 2023
In Unix shells, historically single-quote (apostrophe) is a string that is not to undergo any variable processing, and double-quoted is a string that is to undergo interpolation. So in Unix shells, if you had defined an environment variable named MATLAB, then "$MATLAB/bin/win64/MATLAB.exe" would find the MATLAB environment variable and drop it in in place of the first MATLAB token. ${EXPRESSION} (dollar followed by brace followed by expression followed by close brace) is historically for more advanced processing such as trimming off extensions and putting on new extensions. And historically, `EXPRESSION` (expression in back-quotes) is interpreted by Unix shells as meaning to executed EXPRESSION as a command and drop the standard output in place of the backquoted expression.
I have only used (or even seen) a 'nix box as the host part of the Foxboro I/A (Intelligent Automation) power plant control system simulator at the EPRI I&C Center and only did a very little Fortran code development to customize some of the thermodynamics models to match specific plant configurations some 30 years ago by now...
"... "$MATLAB/bin/win64/MATLAB.exe" would find the MATLAB environment variable and drop it in in place of the first MATLAB token."
Well, it seems the OP used that syntax but I couldn't make it work with powershell, but that also may be operator error; as noted I can't find a thing in the doc that actually talks about how to do such. I'm sure it has to be possible, but it's an almost totally opaque box as to how...
dpb
on 15 Sep 2023
Well, I did some digging and found a tutorial that explained some, but not all...and am both somewhat enlightened but also even more confused than before...
PS C:\Users\owner> $env:MATLAB = 'C:\ML_R2021b'
PS C:\Users\owner> dir env:M*
Name Value
---- -----
MATLAB C:\ML_R2021b
PS C:\Users\owner> "$env:MATLAB\bin\win64\matlab.exe"
C:\ML_R2021b\bin\win64\matlab.exe
PS C:\Users\owner>
does the expansion as advertised, but powershell only returns the string, it doesn't dispatch the command as used to in CMD. Not sure how you then do that yet.
Also, nota bene had to reference "env:MATLAB" to get the environment variable; just plain $MATLAB is (apparently) just a string reference and it hadn't been defined. To do that one just writes
PS C:\Users\owner> $MATLAB = 'C:\ML_R2021b'
and then the OPs syntax is expanded and returns the expect string -- but it still doesn't execute it.
I've no klew as yet on how that is done...
Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!