In Generate .NET Assembly and Build .NET Application, steps are illustrated that cover the basics of customizing your code in preparation for integrating your deployed .NET component into a large-scale enterprise application. These steps include:
Installing MATLAB® Runtime on end user computers
Creating a Microsoft® Visual Studio® project
Creating references to the component and the
Specifying component assemblies and namespaces
Initializing and instantiating your classes
Invoking the component using some implicit data conversion techniques
Handling errors using a basic try-catch block
To implement your .NET assembly on a computer other than the one on which it was built:
If the component is not already installed on the machine where you want to develop your application, run the self-extracting executable that you created in Generate .NET Assembly and Build .NET Application.
Reference the .NET assembly in your Microsoft Visual Studio project or from the command line of a CLS-compliant compiler.
You must also add a reference to the
MWArray component in
See Supported Microsoft .NET Framework Versions for a list of supported framework versions.
Instantiate the generated .NET classes and call the class methods as you would
with any .NET class. To marshal data between the native .NET types and the MATLAB array type, you need to use either the
conversion classes or the
MWArray native API.
For information about these data conversion classes, see the
MWArray Class Library Reference, which is also available in
matlabroot represents your MATLAB installation folder.
To avoid using data conversion classes, see Implement Type-Safe Interface and Integrate into .NET Application.
Typically you should specify names for assemblies and classes that will be clear to programmers who use the generated code. For example, if you are encapsulating many MATLAB functions, it helps to determine a scheme of function categories and to create a separate class for each category. Also, the name of each class should be descriptive of what the class does.
The .NET naming guidelines recommends the use of Pascal case for capitalizing the names of identifiers of three or more characters. That is, the first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. For example:
In contrast, MATLAB programmers typically use all lowercase for names of functions. For example:
By convention, the MATLAB Compiler SDK™ .NET examples use Pascal case.
Valid characters are any alpha or numeric characters, as well
as the underscore (