How can I get a .mltbx package to display a license dialog?

I have been trying to create a toolbox install file (.mltbx) using the "Package Toolbox" app. I would like to implement what I've seen some packages on File Central do: Display a license page, and wait for the user to accept it before proceeding with the install. I tried to place files with names "license.txt", "license.html", "license.xml" and "license" in the root folder to no avail. Root folder structure is like this:
root
myToolbox
file1.m
file2.m
myToolboxDocs
html
file1.html
file2.html
index.html
helptoc.xml
info.xml
license.txt
license.html
license.xml
license.
The generated .mltbx file installs fine, but does not display a license dialog. Dissecting a downloaded package that is able to display a license dialog (I have unzipped it) I can see that the "metadata" folder has a file named "license.xml" that my generated .mltbx file does not have. I must be missing something here, but I cannot figure out what. Any ideas?

Answers (1)

According to the documentation for creating and sharing toolboxes, you need to provide a valid URL to the license file for the license agreement dialog to show up for your users: https://www.mathworks.com/help/releases/R2023a/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html#:~:text=install%20a%20toolbox.-,License%20URL,-%E2%80%94%20The%20URL%20of.
To do this, please modify the "Install Actions" section in the Package a Toolbox dialog box that appears after you select a toolbox folder.
Hope this helps!

3 Comments

Thank you for the answer, but where would I place that URL? The link you have shared is about "additional software" that the user must install in order to use my toolbox, it's not about the license for my toolbox. A download URL for the additional software must also be specified, so the license URL belongs to that additional software.
For a more specific example of what my problem is, take a look at the current version "GUI Layout Toolbox". Its license file does not come from from an URL, it is embedded in the .mltbx file (look in the "metadata" folder). I'm guessing there must be a way to get the toolbox packaging app to place it there, but I just have not seen it anywhere in the documentation.
After looking at your requirements a bit more closely, I think MATLAB currently does not provide a way to add a license for custom toolboxes. The reason why the "GUI Layout Toolbox" shows a license is because it is a toolbox made by MathWorks. However, if you'd like to protect the code used by your toolbox, you can look into obfuscating the code. The following resource provides more details on this: https://www.mathworks.com/help/releases/R2023a/matlab/matlab_prog/protect-your-source-code.html
Must be an undocumented feature then. Obfuscation of code is not the issue here. I think a mechanism should be provided to allow the display of a typical BSD license with standard disclaimers of liability. Anyway, thanks for looking into it.

Sign in to comment.

Categories

Products

Release

R2023a

Asked:

on 17 Jan 2025

Edited:

on 22 Jan 2025

Community Treasure Hunt

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

Start Hunting!