MATLAB Web Server | ![]() ![]() |
Input Template
The file input_template.html
provides the code needed to create a MATLAB Web Server input document. An abbreviated version looks like
<!-- STEP 1 Choose either the NT version or the Unix version of the form tag (depending on which platform the matweb client program will be run): --> <!-- NT version: --> <form action="/cgi-bin/matweb.exe" method="POST"> <!-- Unix version: --> <form action="/cgi-bin/matweb" method="POST"> <!-- STEP 2 Create a hidden field naming your M-file. Replace MY_M_FILE with the name of main MATLAB function of your application.(An HTML input field of type "hidden" is commonly used to pass variables to a web server. It is not displayed by the browser.) --> <input type="hidden" name="mlmfile" value="my_m_file"> <!-- STEP 3 Add all your other HTML form tags here. Replace MY_INPUT_VARIABLE_1 with the name of an input variable in your application. --> <p>My input variable 1: <input type="text" name="my_input_variable_1"> <!-- Create additional input variables here. --> <!-- STEP 4 Create a "submit" input tag for the user to click to send the input to your program. --> <p><input type="submit" name="Submit" value="Submit"></p> <!-- STEP 5 Add the name of your main application function to the file matweb.conf. See the matweb.conf file in the wsdemos directory and the documentation.) -->
webmagic Input
Examine the significant part of the source for webmagic1.html
.
<form action="/cgi-bin/matweb.exe" method="POST">
<input type="hidden" name="mlmfile" value="webmagic">
<p>Magic square size (minimum is 3, maximum is 20):
<input type="text" size="2" maxlength="2" name="msize"></p>
<p><input type="submit" name="Submit" value="Submit"></p>
</form>
calls matweb
, the entry point to the MATLAB Web Server. matweb.exe
is the Microsoft Windows NT name of the program used by the MATLAB Web Server to extract data from HTML forms. On Solaris/Linux this program is called just matweb
. We refer to the program as matweb
throughout this document except when the platform distinction is important. matweb
is described more thoroughly in the next chapter.
provides the name of the MATLAB M-file (mlmfile
) to run. In this application the M-file is named webmagic
.
passes to webmagic.m
a two-character field named msize
, which contains the size of the magic square to compute.
To display the input document and run the magic squares demonstration locally on your computer, start your Web browser and set the URL to http://<your_domain>/webmagic1.html
.
The magic squares input document, webmagic1.html
, is displayed in your browser.
Enter the size of the magic square matrix you want to compute and press Submit.
![]() | Templates | Creating MATLAB Web Server M-Files | ![]() |