When you deploy a Microsoft® ActiveX® control that requires a run-time license, include a license key, which the control reads at run time. If the key matches the license key version of the control, an instance of the control is created. To deploy a run-time-licensed control with a MATLAB® application, use the following procedure.
Create a function,
build the control.
The file must contain two elements:
This pragma causes the MATLAB Compiler™ to
embed a function named
actxlicense into the standalone
executable file you build.
A call to
create an instance of the control.
Place this file in a folder outside of the MATLAB code tree.
Here is an example file:
function buildcontrol %#function actxlicense h=actxcontrol('MFCCONTROL2.MFCControl2Ctrl.1',[10 10 200 200]);
Change to the folder where you placed the function you created
to build the control. Call the function. When it executes this function, MATLAB determines
whether the control requires a run-time license. If it does, MATLAB creates
another file, named
actxlicense.m, in the current
working folder. The
actxlicense function defined
in this file provides the license key to MATLAB at run time.
Call the MATLAB Compiler build function to
create the standalone executable from the file you created to build
the control. The executable contains both the function that builds
the control and the
mcc -m buildcontrol
and the control (