Why do I need a license for functions I wrote?
Show older comments
I recently upgraded to R2017b. I have functions that I wrote myself and reside in a sub-directory of my Matlab work directory. The sub-dir is in my path and Matlab can see the functions via 'which', but it states that there is no license for that function. Why do I need a license for my own function?
Answers (1)
Walter Roberson
on 26 Dec 2017
0 votes
This can happen if you accidentally named the directory with the same name as one of the directories used to hold toolbox functions.
For example, MATLAB stores its Statistics And Machine Learning mnrnd in fullfile(matlabroot, 'toolbox', 'stats', 'stats', 'mnrnd.m') and it can get confused about the licensing required for your files if you happened to store them in a directory named stats
8 Comments
Scott Diamond
on 26 Dec 2017
Walter Roberson
on 26 Dec 2017
What are the directory names above that?
Image Analyst
on 26 Dec 2017
Give 3 names of functions for which it says you have no license, as an example. Of course you can always call the tech support installation hotline for the fastest installation help.
Scott Diamond
on 26 Dec 2017
Edited: Walter Roberson
on 26 Dec 2017
Image Analyst
on 27 Dec 2017
Walter Roberson
on 27 Dec 2017
What was the previous directory name? Have you happened to restart MATLAB after you renamed the directory? That could fix the problem. Or use "clear" with the names of the functions might fix the problem.
Scott Diamond
on 28 Dec 2017
Edited: Image Analyst
on 28 Dec 2017
Image Analyst
on 28 Dec 2017
Do you have any .lic files in your search path? Have you read the help on licenses:
Understanding License Files
License File Description License File Search Path License File Description A License File is a specially formatted ASCII text file that contains encrypted product passcodes for each product you are licensed to run. Each product passcode identifies the number of keys available for that product. The license manager grants or denies access to a product depending on the availability of the license keys associated with each product.
The following figure presents a sample License File. Each INCREMENT line identifies a product, the number of keys available for the product, and other information. (The INCREMENT lines in your License File might not include every element shown in the example.) The backslash (\) character indicates that the line continues onto the next line.
The lines that begin with a pound sign (#) are comments. The MathWorks Installer uses the information in these comment lines (license server host ID or Internet address) when it processes the License File during installation.
- BEGIN-------cut here-------CUT HERE-------BEGIN
- MATLAB license passcode file.
- LicenseNo: 12345 HostID: INTERNET=144.212.101.43INCREMENT TMW_Archive MLM 18 01-sep-2015 0 \ BC9DE773A77D15AF8 VENDOR_STRING=83 HOSTID=DEMO SN=12345INCREMENT MATLAB MLM 18 01-sep-2015 1 \ 4C9D3348561BE9E3B USER_BASED DUP_GROUP=U SN=12345INCREMENT SIMULINK MLM 18 01-sep-2015 1 \ 1CD148466EF58DF8B USER_BASED DUP_GROUP=U SN=12345INCREMENT Signal_Toolbox MLM 18 01-sep-2015 1 \ 6CF74B458BA143DC3 USER_BASED DUP_GROUP=U SN=12345
- END---------cut here-------CUT HERE-------ENDLicense File Search PathWhen you start MATLAB®, it reads the License File to check for product licensing. MATLAB searches for the License file in the following locations, in the specified order. After it finds a License File, MATLAB stops searching.
License File specified on MATLAB startup command line using the -c option. You can specify a list of paths to search. When you use the -c option, you explicitly prohibit the searching of the environment variables. When using the -c option, keep in mind the following: If the path to your License File contains a space, enclose the path name in quotation marks. If you are specifying more than one License File, make sure to enclose the entire list of License Files in quotation marks. If no License File is specified at the MATLAB command line, MATLAB searches two environment variables, described in the following table. MATLAB searches the vendor-specific environment variable, MLM_LICENSE_FILE first. Environment Variable Purpose MLM_LICENSE_FILE Specifies the location of the License File, but only for MathWorks® products. (Recommended, because it affects only MathWorks products.) LM_LICENSE_FILE Specifies the location of the License File for all applications using FlexNet® licensing on this server. If it does not find any License File specified using environment variables, MATLAB searches the profile folder of the person starting the program. For licenses that are locked to individual users, the activation application puts the License File in a folder in your user profile. If it does not find any License File specified in environment variables or in your user profile, MATLAB checks the \licenses folder in your MATLAB installation for files named license.dat or any file with the extension .lic.
Categories
Find more on Introduction to Installation and Licensing 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!