The attached ZIP-file contains an example Microsoft Visual Studio 7.1 project that contains the CPP-file calling the .NET object. This example demonstrates a simple addition of two matrices.
To build the application, follow the steps detailed below:
1. Execute
at the MATLAB command prompt and select a supported C/ C++ compiler such as Microsoft Visual Studio 2005. Note that the LCC compiler cannot be used to build the component.
2. Launch DOTNETTOOL by typing
at the MATLAB command prompt.
3. Create a new project by selecting "File -> New Project" menu item and enter the component name as 'AddMatrix'. Enter the class name as 'MatrixAdder'.
4. Once you are returned to the MATLAB Builder window, highlight the component, click the "Add File" button and add addmatrix.m
5. Select "Build -> .NET object" from the menu to build the .NET object.
6. Open 'MWArrayExample' in Visual Studio.
8. In the Solution Explorer tab, right-click on 'MWArrayExample' and choose "Add Reference...". Add references to the above component as well as to the file MWArray.dll. This file is located in $MATLAB/bin/win32 (where $MATLAB is the MATLAB root directory on your machine, as returned by typing
at the MATLAB command prompt.)
9. Select "Build -> Build Solution" from the menu and then execute the application. You should see the result of adding two matrices upon successful execution.
Best Answer