ComputationVisualizationProgrammingFor Use with MATLAB®MATLAB Web ServerVersion 1MATLAB Web Server
PrefaceviiiRelated ProductsThe MATLAB Web Server requires MATLAB Release 11 or later. No other MathWorks-supplied software is required.See “Product R
Related ProductsixMATLAB C/C++ Graphics LibraryLibrary for automatically compiling MATLAB programs that contain graphics and graphical user interfaces
1MATLAB on the WebIntroduction . . . . . . . . . . . . . . . . . . . . 1-2MATLAB Web Server Environment .
1 MATLAB on the Web1-2IntroductionMATLAB Web Server EnvironmentThe MATLAB® Web Server enables you to create MATLAB applications that use the capabilit
Introduction1-3In a more complex network, the Web server daemon can run on a machine apart from the others.Building MATLAB Web Server ApplicationsMATL
1 MATLAB on the Web1-43 Write a MATLAB M-file that:a Receives the data entered in the HTML input form.b Analyzes the data and generates any requested
Product Requirements1-5Product RequirementsThe MATLAB Web Server has the same supporting hardware and software requirements as MATLAB itself, except f
1 MATLAB on the Web1-6InstallationAvailabilityThe MATLAB Web Server is available on UNIX (Solaris) workstations and IBM PC compatible computers runnin
Installation1-7-m 1This number represents the number of MATLABs that can run concurrently. After testing that everything is working properly, you can
How to Contact The MathWorks:www.mathworks.com Webcomp.soft-sys.matlab [email protected] Technical [email protected] Product
1 MATLAB on the Web1-8•Copy matweb.conf in <matlab>/toolbox/webserver/wsdemos to the directory aliased by /cgi-bin or equivalent. •Copy all demo
Installation1-9at the command prompt to see detailed information about a specific script.After completing the MATLAB and MATLAB Web Server installatio
1 MATLAB on the Web1-103 Open the copied file in a text editor and follow the directions for modifying the file. Save and close the file when you are
Installation1-114 Solaris users should create a link in the rc directory associated with run level 3.cd /etc/rc3.d; ln -s ../init.d/webserver S20webse
1 MATLAB on the Web1-12DeinstallationTo remove MATLAB Server from the Windows NT Registry, open a command prompt (MS-DOS) window. Enter the command se
Graphics Display1-13Graphics DisplayWe recommend that Solaris/Linux users use Virtual Network Computing (VNC) for their X display. VNC can be used eve
1 MATLAB on the Web1-14The file directory created contains a README file that discusses how to install the software. The directory contains four files
Graphics Display1-15The first time you run the vncserver, you will be prompted for a password. This password controls access to the VNC viewer, which
1 MATLAB on the Web1-16webstart -display :1[webstart]:Calling webdown to take down MATLAB Web Server . . . No s
2Getting StartedIntroduction . . . . . . . . . . . . . . . . . . . . 2-2Templates . . . . . .
iContentsPrefaceAbout This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viOrganization of the Document . . . .
2 Getting Started2-2IntroductionThe process of creating a MATLAB Web Server application involves the creation of:•An HTML input document for data subm
Introduction2-3•webmagic1.html: the webmagic input document•webmagic2.html: the webmagic output document•webmagic.m: the webmagic MATLAB M-file•twebma
2 Getting Started2-4Creating Input DocumentsInput TemplateThe file input_template.html provides the code needed to create a MATLAB Web Server input do
Creating Input Documents2-5<p><input type="submit" name="Submit" value="Submit"></p><!-- STEP 5Add
2 Getting Started2-6To display the input document and run the magic squares demonstration locally on your computer, start your Web browser and set the
Creating MATLAB Web Server M-Files2-7Creating MATLAB Web Server M-FilesM-File TemplateYou use the M-file template to code your MATLAB application as y
2 Getting Started2-8% created and the filename you created from OUTPUT_TEMPLATE.HTML.% Replace <OUTPUT_TEMPLATE.HTML> with the name of the HTML
Creating MATLAB Web Server M-Files2-9% Create magic square in output structure OUTSTRUCT.outstruct.msquare = magic(msize);% Get column, row, and diago
2 Getting Started2-10Creating Output DocumentsOutput TemplateThe file output_template.html provides the code needed to create a MATLAB Web Server outp
Creating Output Documents2-11The source for the webmagic2.html template document looks like<!--HTML output template used by webmagic.m in call to t
ii Contents2Getting StartedIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2Templates . . . . . .
2 Getting Started2-12When displayed in a browser, webmagic2.html looks like
Debugging Your Application2-13Debugging Your ApplicationDebugging ProcedureYou can use the MATLAB debugging facility plus your Web browser to debug yo
2 Getting Started2-14outfile in this case is twebmagic.html, the second argument passed to webmagic.The second step in debugging is to use your Web br
Additional Application Examples2-15Additional Application ExamplesThe easiest way to learn how to create MATLAB applications that send and receive dat
2 Getting Started2-16The URL for the players example ishttp://<your_domain>/cgi-bin/matweb.exe?mlmfile=players& on Windows NT. (On Solaris/L
Additional Application Examples2-17This input document allows you to set the characteristics of the peaks plot you want to generate. This is a more co
2 Getting Started2-18also be used to maintain contexts among the different connections in an application.You can see this in the codes.GraphFileName =
Additional Application Examples2-19Note When the input form contains a “clickable” image created by an <input> tag of the form <type = "
2 Getting Started2-20Stock Price SimulationNow that you are familiar with the use and operation of the MATLAB Web Server, look at webstock, a program
3Inside the MATLAB Web Server MATLAB Web Server Components . . . . . . . . . . 3-2File Locations . . . . . . . .
iii4ReferenceFunction Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2htmlrep . . . . . . . . . . . . . . . . . .
3 Inside the MATLAB Web Server3-2MATLAB Web Server ComponentsThe MATLAB Web Server consists of a set of programs that enable MATLAB programmers to cre
3-3:Figure 3-1: MATLAB on the WebInitial HTMLForm or URLGenerated HTML FormClient1MATLABClientnhttp daemonmatwebmatlabserver M-filesDataGraphicsInit
3 Inside the MATLAB Web Server3-4File LocationsAny M-files used in conjunction with a Web application, including matweb.m, must appear on the MATLAB p
Understanding matlabserver3-5Understanding matlabservermatlabserver is designed to run continuously in the background as a Windows NT service or as a
3 Inside the MATLAB Web Server3-6Note that the values for the variables can contain references to other shell variables using the normal shell $ notat
Understanding matlabserver3-7Changing Initial DataEdit matlabserver.conf on Windows NT. On Solaris/Linux run the webconf script to initialize the matl
3 Inside the MATLAB Web Server3-8When the MATLAB Web Server is installed, matweb is placed in <matlab>/webserver/bin/arch for all architectures.
Understanding matlabserver3-9All the fields that can be contained in matweb.conf are described in Table 3-2.After you create a new MATLAB Web Server a
3 Inside the MATLAB Web Server3-10matweb M-FileLooking again at the source from the webmagic1.html file (see “webmagic Input” on page 2-5), observe th
4Reference
iv Contents
4 Reference4-2Function SummaryThis chapter provides detailed descriptions of the functions in the MATLAB Web Server.Function PurposehtmlrepReplace var
htmlrep4-34htmlrepPurpose Substitute values for variable names in HTML documentSyntax outstring = htmlrep(instruct,infile)outstring = htmlrep(instruc
htmlrep4-4Note The extendmemory attribute is designed only for use with htmlrep independently of the MATLAB Web Server. Using it with the MATLAB Web
htmlrep4-5<SELECT NAME="NAMELIST" SIZE=10 AUTOGENERATE=$mylist$ MULTIPLE> <OPTION SIZE=6> </SELECT> htmlrep uses the HTML
matweb4-64matwebPurpose MATLAB Web Server main entry point Syntax matweb(instruct)Description matweb is an M-file that in turn calls a MATLAB applicat
wscleanup4-74wscleanupPurpose Purge stale files from directorySyntax deletecount = wscleanup(filespec,timewindow,direc)deletecount = wscleanup(filespe
wsprintjpeg4-84wsprintjpegPurpose Create JPEG fileSyntax status = wsprintjpeg(fig, jpegfilename)Description status = wsprintjpeg(fig, jpegfilename) cr
wssetfield4-94wssetfieldPurpose Add new field or append to existing field Syntax s = wssetfield(s,name1,value1,...)Description s = wssetfield(s,name1,
wssetfield4-10
ADirectory Structure
PrefaceAbout This Book . . . . . . . . . . . . . . . . . . . viOrganization of the Document . . . . .
A Directory StructureA-2MATLAB is distributed in compressed format on CD. The installation procedure moves the files to your hard disk, decompresses t
A-3You must also place a copy of the appropriate matweb executable and matweb.conf into the /cgi-bin aliased subdirectory of the HTTP server root d
A Directory StructureA-4Table A-4: <matlab>/toolbox/webserver/wsdemos File Purposedummy.htmlTemporary HTML document in bottom frame of webpeaks
A-5File Purposewebpeaks1.htmlHTML framewebpeaks2.htmlpeaks plot output formwebstock.htmlStock price simulation input formwebstock1.htmlStock price sim
A Directory StructureA-6
BTroubleshooting Web ServerGeneral Troubleshooting . . . . . . . . . . . . . . . B-2Additional Troubleshooting for Wi
B Troubleshooting Web ServerB-2This section provides three categories of troubleshooting information:•General Troubleshooting•Additional Troubleshooti
B-3Application-Specific Log File Not ProducedIf present, the mllog variable in matweb.conf ( see “matweb.conf” on page 3-8) creates an application-spe
B Troubleshooting Web ServerB-41 matlabserver is not running.On Solaris or Linux run the webstat script. On Windows NT click the Start button, open th
B-5Viewer appears, click on Log on the menu bar and choose Application from the pull-down menu.Double-click on a matlabserver entry to receive additio
PrefaceviAbout This BookThis book describes the MATLAB® Web Server. The MATLAB Web Server lets you deploy MATLAB based applications over a network us
B Troubleshooting Web ServerB-6Startup SequenceIf you install a new version of MATLAB and the MATLAB Web Server, you need to start MATLAB before start
CSelected Bibliography
C Selected BibliographyC-2Numerous books have been published about HTML programming and the World Wide Web. Two that we have found both useful and rea
I-3IndexAalias 1-8aliases 1-7applications 1-3authoring systems 1-3availability 1-6Bbind error B-3browsers 1-5Cconfiguration files 3-2configuration set
IndexI-4nomenclature 2-5single entry B-4matweb program 3-7matweb.conf 3-8application development 1-3format 1-6locating graphic files 1-7mldir 3-9mllog
IndexI-5Solaris B-6Windows NT B-4twebmagic.m 2-13typographical conventions (table) viiVvirtual network computing (VNC) 1-13VNCvirtual network computin
IndexI-6
Typographical ConventionsviiTypographical ConventionsThis manual uses some or all of these conventions.Item Convention Used ExampleExample code Monosp
Comments to this Manuals