How do I leverage the MATLAB Engine to deploy my MATLAB code over the web for an ASP.NET application using MATLAB 7.3 (R2006b)?

1 Ansicht (letzte 30 Tage)
I would like to deploy my MATLAB code over the web using an ASP.NET application, and would like to use the MATLAB Engine API. I would prefer to use an existing example as a template.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 19 Apr. 2019
Bearbeitet: MathWorks Support Team am 18 Apr. 2019
This bug has been fixed in R2007b. For previous product releases, read below for any possible workarounds:
This example demonstrates how to deploy a MATLAB Engine application on the Web using ASP.NET.
The attached example is an ASP.NET adaptation of MATLAB Web Server's "webpeaks" demo that calls the MATLAB Engine. This example was created with MATLAB 7.3 (R2006b) and Microsoft Visual Studio 2005; the exact steps may differ for other versions.
To build and execute this example,
1. Open Microsoft Visual Studio 2005 and select File->New->Website from the menu bar.
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 register it as a COM Automation Server as shown here:
This registration is done when installing MATLAB, but may need to be done again if you have several versions of MATLAB installed.
5. In MATLAB, set your current working directory to the directory created in step 2. Modify line 49 in "ASPwebpeaks.m" to point to the 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. In Microsoft Visual Studio, select Website->Add Existing Item and add the files "peaksplot.aspx" and "peaksplot.aspx.vb" to your web application project.
7. Select the file "peaksplot.aspx" in the Solution Explorer then select Website->Set As Start Page.
8. Modify line 37 of "peaksplot.aspx.vb" to read:
myMATLAB.Execute("addpath C:\mydirectory\")
where "mydirectory" is the project directory in step 5.
9. Modify line 44 of "peaksplot.aspx.vb" to read:
Image1.ImageUrl = "http://localhost/mydirectory/" & imagepath
where "mydirectory" is the project directory in step 5.
10. Configure MATLAB for DCOM access using the following instructions:
Make sure you use the ProgID Matlab.Application.Single (version 7.0) for user ASPNET, with full launch and access permissions.
11. Test the application by selecting Debug->Start Without Debugging
To test the application outside Microsoft Visual Studio you 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.
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.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2006b

Community Treasure Hunt

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

Start Hunting!

Translated by