Matlab Web Server安装配置大全(亲测有效)

Matlab Web Server安装配置大全(亲测有效)环境:win7 64位系统开发工具:MATLAB7.0网站架构:wampserver步骤:matlab 7.1注册码:PLP:14-24872-36179-32308-22113-61986-33825-00564-45479-60426-10395-51330-19488-62201-37785-19497-45389-18974-51073-03706-04875-59691-49786-28969-00719-61582-14402-53787-33213-56814-33775-57022-14254-56498MATLAB的安装目录是:D:/MATLAB7.0/这两个文件的来源:MATLAB的安装目录下toolbox/webserver/wsdemos/可以找到,copy过来就行同样,将toolbox/webserver/wsdemos里面的几张图片拷到icons文件夹里(图片不烤也没关系,只是网页里面的预设图片无法显示,但不影响程序的运行)1.安装MATLAB7.02.安装Wampserver3.配置(最麻烦也是最容易出错的地方,鼓捣了好久终于调通了)4.调试

5.加入自己编写的M文件进行调试

详细步骤:1.安装MATLAB7.0安装的时候有两个选项(typical和custom),选择custom,也就是自定义需要安装的组件,以确保安装matlab web server组件2.安装Wampserver下载后根据提示安装就行,用户名填:localhost,邮箱可不填。设安装在D:/wamp/,则根目录为D:/wamp/www/3.配置(最麻烦也是最容易出错的地方,鼓捣了好久终于调通了)我的网站根目录是:D:/wamp/www/MATLAB的webserver所需要的.m文件在D:/MATLAB7.0/toolbox/webserver/wsdemos/下面讲到的根据自己的实际情况更改即可。3.1 网站根目录下创建cgi-bin、icons两个文件夹。cgi-bin文件夹只需包含matweb.conf和matweb.exe两个文件3.2 MATLAB的安装目录下toolbox/webserver/wsdemos文件夹下面的所有HTML文件复制到网站根目录D:/wamp/www/下(主要是些例子,安装MATLAB的时候它提供了四个例子)3.3(重要)修改D:/wamp/bin/apache/Apache2.2.21/conf/extra下的httpd-autoindex.conf文件把D:/wamp/bin/apache/Apache2.2.21/conf/extra中的httpd-autoindex.conf文件做如下修改:把Alias /icons/ "c:/apache2/icons/"修改为自己的路径:Alias /icons/ "D:/wamp/bin/apache/apache2.2.22/icons/";把<Directory "c:/apache2/icons">修改为自己的路径:<Directory "D:/wamp/bin/apache/apache2.2.22/icons/">(如果不修改的话,访问会提示问题:Forbidden You don’t have permission to access /icons/ on this server.)3.4(重要)修改D:/wamp/www/cgi-bin/下的matweb.conf文件把原文件:<span style="font-size:18px;">[webmagic]mlserver = <matlabserver_host_name>[webpeaks]mlserver = <matlabserver_host_name> mldir = <matlab>/toolbox/webserver/icons[webstockrnd]mlserver = <matlabserver_host_name>mldir=<matlab>/toolbox/webserver/wsdemos[players]mlserver = <matlabserver_host_name>mldir=<matlab>/toolbox/webserver/wsdemos</span>修改为:<span style="font-size:18px;">[webmagic]mlserver = localhost[webpeaks]mlserver = localhostmldir = D:/wamp/www/icons[webstockrnd]mlserver = localhostmldir = D:/wamp/www/icons[players]mlserver = localhostmldir = D:/MATLAB7.0/toolbox/webserver/wsdemos</span>解释:[webmagic] /*.m对应的文件名,用方括号括起来*/mlserver = localhost /*你的服务器的ip*/mldir = D:/wamp/www/icons /*图片存放的绝对路径,也就是上面在网站根目录下创建的文件夹icons的路径*/4.调试安装Wampserver之后,打开Wampserver,网页地址输入进行调试,有四个例子,皆可调试成功。5.加入自己编写的M文件进行调试5.1编写mytest1.html文件,存到D:/wamp/www/目录下,代码如下:

<html><head><title>matlab web server test</title></head><body bgcolor="#FFFFFF"><div align="center"><form action="/cgi-bin/matweb.exe" method="POST" target="outputwindow"><input type="hidden" name="mlmfile" value="test2"><p>a=<input type="text" size="2" maxlength="2" name="numa" /></p><p>b=<input type="text" size="2" maxlength="2" name="numb" /></p><p><input type="submit" name="Submit" value="c=a+b=?"></p></form></div></body></html>

5.2编写mytest.m文件,存到D:/MATLAB7.0/toolbox/webserver/wsdemos/目录下,代码如下:

function sum = test(instruct)numa = str2double(instruct.numa);numb = str2double(instruct.numb);outstruct.numa = numa;outstruct.numb = numb;outstruct.numc = numa + numb;templatefile = which('mytest2.html');sum = htmlrep(outstruct, templatefile);

5.3编写mytest2.html文件,存到D:/MATLAB7.0/toolbox/webserver/wsdemos/目录下,代码如下:车到山前必有路,没路可以先开路,开路就得有乐观,

Matlab Web Server安装配置大全(亲测有效)

相关文章:

你感兴趣的文章:

标签云: