How can I load a figure generated by a MATLAB Builder for .NET 2.1 (R2006b) component in an ASP.NET application?

1 view (last 30 days)
I want to display a figure generated by a MATLAB Builder for .NET component. MATLAB Web Server made use of the WSPRINTJPEG function, and I would like to know what MATLAB function I should use in order to deploy MATLAB figures over the web.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The documentation for MATLAB 7.6 (R2008a) has been updated to incorporate the example listed below. For previous product releases, please read the following:
Documentation for MATLAB Builder for .NET 2.1 (R2006b) does not include an example to deploy a component on the web using ASP.NET. Here is an example of how this could be done:
To deploy MATLAB figures over the web, you can use the PRINT function to create an image instead of using WSPRINTJPEG. For more information regarding the PRINT function, you can refer to the following URL:
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/print.html>
The attached example is an ASP.NET adaptation of MATLAB Web Server's webpeaks demo that calls a MATLAB Builder for .NET generated web component. This example was created with MATLAB Builder for .NET 2.1 (R2006b) and Microsoft Visual Studio 2005; the exact steps may differ for other versions.
To build and execute this example, follow the steps given below:
1. Open Microsoft Visual Studio 2005 and select File->New->Website from the menubar.
2. Select ASP.NET Web Site and then enter the location for the web site.
3. Download and extract the attached ZIP-file to the directory created in step 2.
4. Start MATLAB and point your current working directory to the directory created in step 2.
5. Modify line 49 in ASPwebpeaks.m to point to the project directory created in step 2. For example, if you created the project in C:\mydirectory, the line should read
print('-djpeg',['C:\mydirectory\' filename]);
6. Execute the following command at the MATLAB command prompt to create the .NET component.
mcc('-W', 'dotnet:webpeaks,webpeaksclass,0.0,private', '-T','link:lib', '-v','class{webpeaksclass:ASPwebpeaks.m}')
Note: A graphical tool called DEPLOYTOOL is also available for building .NET components.
7. In Microsoft Visual Studio, select Website->Add Existing Item and add the files peaksplot.aspx and peaksplot.aspx.vb to your web application project.
8. Select Website->Add Reference and from the .NET tab select "MathWorks, .NET MWArray API". Click OK.
9. Select Website->Add Reference and from the Browse tab select the file webpeaks.dll generated in step 6 above.
10. Select the file peaksplot.aspx in the Solution Explorer then select Website->Set As Start Page.
11. Test the application by selecting Debug->Start Without Debugging
To test the application outside Microsoft Visual Studio you will need to configure IIS so that the project folder is accessible and has the proper permissions for clients to run scripts and have write access. Additionally you may need to configure IIS to use the proper version of ASP.NET.
For more information on MATLAB web deployment, refer to the following tech note:
<http://www.mathworks.com/support/tech-notes/1600/1608.html>
Note: MathWorks does not provide technical support for Microsoft Visual Studio, Microsoft Internet Information Services (IIS) and can only provide assistance on how to use our products' API and the API for components created with our products.

More Answers (0)

Categories

Find more on Get Started with MATLAB Compiler SDK in Help Center and File Exchange

Products


Release

R2006b

Community Treasure Hunt

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

Start Hunting!