<p>CODE</p><p>Link m-file between DDA application and MWS</p><p>Webfun.m function Webfun(ParList,menuchoice,menuitems,returnfilename) % DDA application m-file for the link to Matlab Web Server % Authors Inger Bolin & Maria Borg % Date: 2002-03-08</p><p>%Give the file a static name sendfile='c:\temp\ABBfile.mat';</p><p>%Save all parameters needed for calculations save(sendfile, 'ParList','menuchoice','menuitems','returnfilename');</p><p>%Start the HTML input document stat = web('http://C4000129/indexphp.php?filename=ABBfile.mat&filepath= C:/temp/ABBfile.mat', '-browser');</p><p>Input HTML document indexphp.php</p><p><html> <head><title>Drive Dynamics Analyzer Calculation</title></head> <body background="/icons/bakgrund.jpg"> <br><br><br><br> <!--img src="/icons/valsvinkel.jpg" width="200" height="230" align="right"--> <form enctype="multipart/form-data" method="POST" ></p><p><table bgcolor ="#FFF1A1" class="table" border="1" cellpadding="0" cellspacing="0" width="400"> <tr><td colspan="4" height="23"> <strong> Browse to upload this file: <?echo $filepath;?></strong></td></tr> <tr> <td colspan="2" align="right" height= "23"> <input type="file" name="file" size="30" class="input" ></td><br> </tr> </table><br></p><p><p><font color="#000000" size="3" face="Arial"> Click button to send file!</p><p><p><font color="#164781" size="4" face="Arial"> <p><input type="submit" name="Submit" value="Send file"></p></font> <br></p><p>1 <p><font color="#000000" size="3" face="Arial"> Please then wait for result file to download</font> <br> <?php if($REQUEST_METHOD == "POST") { if(($HTTP_POST_FILES['file']['name'])==$filename){ $strPath = "C:/Matlab6p1_web/toolbox/webserver/wsdemos/"; $strFilename = uniqid ("")."_" .$HTTP_POST_FILES['file']['name']; if (! file_exists($strPath . $strFilename)){ if ((move_uploaded_file($file, $strPath . $strFilename))) { virtual("/cgi-bin/matweb.exe?mlmfile=mtest" . "&filename=" . $strFilename); } else {?><strong><font color="#FF0000" size="3" face="Arial"> File upload error!</strong><? } } } else {?><strong><font color="#FF0000" size="3" face="Arial"> Attempt to upload the wrong file!</strong><? } }?> </form> </body> </html></p><p>MWS application m-file for calculation mtest.m function rs = mtest(h, outfile) % MWS application m-file for the compiled DDA application, advanced calculations % through a web server % Authors Inger Bolin & Maria Borg % Date: 2002-03-08</p><p>% Set to MWS directory cd(h.mldir);</p><p>% Save input file to local variable filename = h.filename;</p><p>% Load .mat-file into workspace load(filename);</p><p>% Delete the input file from MWS directory delete(filename);</p><p>2 % Call to simprocess() for calculation if isempty(ParList) data=simprocess('', menuchoice, menuitems, data); else data=simprocess(ParList, menuchoice, menuitems); end</p><p>% Call to datahistory() datahistory(data); data_history=evalin('base','data_history'); </p><p>% Make an unique result file using parameter from customer resfile=returnfilename;</p><p>% Save in structure ready for plotting if exist('data_history') Session.DataHistory=data_history; else error ('Failed updating data_history'); end</p><p>% Save workspace to result file save(resfile,'Session');</p><p>% Save to output structure s.filename = resfile; s.mlid=h.mlid; s.mldir=h.mldir;</p><p>% Output the output structure to output HTML document path = which('output.html'); if(nargin == 1) rs = htmlrep(s, path); elseif(nargin == 2) rs = htmlrep(s, path, outfile); end</p><p>Output HTML document output.html</p><p><html> <body link="#4A94D5" alink="#426997" vlink="#9A3464"> <br><br><br> <strong>Result file successfully executed! <br><br> <p align="left">Download <a href="$filename$">$filename$</a> to your disc</strong> </body> </html></p><p>3 CONFIGURATION FILES</p><p>To connect with MWS matweb.exe requires information stored in matweb.conf matweb.conf</p><p>[mtest] mlserver=127.0.0.1 mldir=C:/matlab6p1_web/toolbox/webserver/wsdemos</p><p>Initial settings for MWS matlabserver.conf</p><p>-m 1</p><p>4</p>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-