Prashant Kumar answered . 2024-12-22 11:54:49
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
Not satisfied with the answer ?? ASK NOW