How do I deploy a Simulink model over the web using MATLAB Compiler 4.5 (R2006b)?

3 views (last 30 days)
I have a Simulink model that I wish to deploy via the web. Due to licensing restrictions, the MATLAB Engine cannot be used for this purpose. I would like to know how the MATLAB Compiler can be used for this purpose. I would also like to know what additional products are needed.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Dec 2018
In order to deploy a Simulink model over the web using MATLAB Compiler, you will need to have Real-Time Workshop installed. In addition, if you wish to create an HTML-file that displays your Simulink model, you will need to have Simulink Report Generator installed as well.
This solution assumes that you have set up a cgi-bin directory on your web server that allows for client permissions to run scripts and executables. For guidance on this setup, we recommend that you consult with your system administrator.
Here are the steps you will need to follow to deploy a Simulink model over the web:
1. Download the attached ZIP-file to your working directory and extract its contents.
2. Start MATLAB.
3. Open the Simulink model test.mdl and hit Ctrl-B to build the standalone test.exe.
4. Select File->Export to Web option from the menubar and click OK. If you are prompted to download the SVG viewer plug-in, then click on the link and follow the instructions from Adobe's website. Once you have successfully installed the plug-in, close your web browser and simulink model.
5. At the MATLAB command prompt, issue
x=5;
p = rsimgetrtp('test','AddTunableParamInfo','on');
save paramfile p;
These commands will generate the MAT-file that is required by test.exe.
6. At the MATLAB command prompt, issue:
mcc -m simweb
This command will compile the MATLAB file simweb.m into a standalone executable simweb.exe. The simweb.exe file will be responsible for generating the HTML content that displays the Simulink output in the form of a MATLAB figure.
7. At the MATLAB command prompt, issue
!simweb
in order to test this executable and pre-extract the CTF-archive file.
8. Open test_slwebview.html in a text editor and modify its content such that it reads:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html><head><title>Simulink Web View</title></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<embed height="100%" width="100%" src="./test_slwebview_files/test_slwebview.svg" type="image/svg+xml" pluginspage="<http://www.adobe.com/svg/viewer/install/ http://www.adobe.com/svg/viewer/install/">>
<noembed>
<p><b>SVG Renderer Required</b>: Your browser does not support Scalable Vector Graphics. Install the free <a href="<http://www.adobe.com/svg/viewer/install/ http://www.adobe.com/svg/viewer/install/">>Adobe SVG Viewer</a> plugin or a <a href="<http://www.mozilla.org/products/firefox/all http://www.mozilla.org/products/firefox/all">>SVG-compatible web browser</a> to view this Simulink model.</p>
</noembed>
</embed>
<FORM ACTION="/cgi-bin/simweb.exe">
<P>Please specify the Gain value:
<INPUT NAME="gain" SIZE="5"><BR>
<INPUT TYPE="SUBMIT" VALUE="Go!">
</FORM>
</body></html>
Save the file once you have modified it.
9. Transfer the following files/folders to your cgi-bin directory:
simweb.exe
simweb.ctf
test_slwebview_files
test_slwebview.html
test.exe
paramfile.mat
10. If your Web Server is running locally, you should be able to reach the test project through the following URL:
"http://localhost/cgi-bin/test_slwebview.html"
At this point, you should be able to see your Simulink model and modify the Gain value. After you hit the "Go!" button, the output will be displayed.

More Answers (0)

Categories

Find more on Application Deployment in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!