从网上访问Matlab GUI [英] Access to a Matlab gui from the web
问题描述
有没有办法将我拥有的Matlab GUI放置在网站上,以便用户可以使用或玩(类似于Java Applet等)?在某种意义上,我需要进行不同的编译吗?
Is there a way to place a matlab gui I have on a website, such that users could use or play with, similar to java applets etc? Would I need to compile it differently in some sense?
推荐答案
MATLAB编译器允许您创建一个独立的exe,您的网络服务器可以使用通用网关接口(CGI)来调用该exe.
MATLAB Compiler allows you to create a standalone exe which can be called by your web server using the Common Gateway Interface (CGI).
CGI脚本通过将HTML打印到屏幕(stdout
)来输出HTML.您可以通过环境变量query_string
输入CGI脚本.可以使用Matlab函数getenv
和fprintf
编写一个简单的CGI脚本.
The CGI script outputs HTML by printing it to the screen (stdout
). You can input to a CGI script through the environment variable query_string
. A simple CGI script can be written Using the Matlab functions getenv
and fprintf
.
但是请不要忘记检查您是否已正确配置Web服务器以运行CGI程序,并且能够执行独立的CGI程序.
But don't forget to check that you have configured your web server properly in order to run CGI programs, and that you are able to execute a CGI program that is independently.
有一个示例展示了如何在Mathworks网站中执行此操作.执行以下步骤来编译并运行此示例:
There's an example which demonstrates how to do this in Mathworks website. Perform the following steps to compile and run this example:
- 将MATLAB文件编译成一个独立的应用程序.这可以在MATLAB中使用以下命令来完成:
mcc -m mycgimagic.m
- 将HTML文件复制到Web服务器,并将其放置在具有适当权限的目录中.请查阅您的Web服务器文档以了解操作方法.
- 将exe和CTF文件复制到Web服务器,并将它们放置在网站的"/cgi-bin"目录中.您需要将Web服务器配置为具有适当的权限,才能执行exe文件.请查阅您的Web服务器文档以了解操作方法.
- 在Web服务器上安装MCR.
- 第一次从Web服务器系统本身执行exe文件,以强制执行CTF存档提取.
- 从远程计算机的Web浏览器中加载HTML文件,然后提交表单以执行CGI程序.
- Compile the MATLAB file into a standalone application. This can be done with the following command in MATLAB:
mcc -m mycgimagic.m
- Copy the HTML file to the web server and place it in a directory with the proper permissions. Consult your web server documentation for how to do this.
- Copy the exe and CTF files to the web server and place them in the "/cgi-bin" directory of your website. You will need to configure the web server to have the proper permissions to be able to execute the exe-file. Consult your web server documentation for how to do this.
- Install the MCR on the web server.
- Execute the exe-file for the first time from the web server system itself in order to force the CTF-archive extraction.
- Load the HTML-file in a web browser from the remote computer and submit the form to execute the CGI program.
这篇关于从网上访问Matlab GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!