Linux下后台运行matlab 命令如下:
其中name.m是你自己的M文件. 更完整的写法应该是:
同样:matlab< name.m >& name.out & 就够了,不用nohup。 ============================================================================== UsingMATLAB with PHP http://www.danpearce.co.uk/php_and_matlab Thefollowing example describes how to use PHP to run MATLAB commands.With there being so many different possible system configurations,it is likely that you may have to modify these steps slightly foryour own use. I am using: MATLABR2009aWindowsVista Inthis example, we will create a MATLAB function that generates a textfile of random numbers. The location of this file is user definedfrom an HTML form. We use PHP to link the two together. The MATLABfile First,we need create a very basic MATLAB function that creates a plaintext file. The only input is a filename. Obviously, you'd want someslightly more robust checks normally. Using any plain text editor,copy and paste the following code and save as phpcreatefile.m (makea note of the file path as you'll need it later):
Noticethe last line of this file. The 'Quit' command is necessary toterminate MATLAB when we're finished. The PHP file Next,we need to create a file that renders an HTML form that, whensubmitted, opens MATLAB and calls the function phpcreatefile with afilename taken from the form. copy and paste the following code intoa php file:
Theabove code first creates an extremely basic HTML form that asks theuser for a filename. When submitted, the form submits to self,making the filename available as a $_POST variable. Next, a block ofPHP code checks to see if the form is submitted. If it is, we startto try and build the appropriate command to send to MATLAB. 1. $filename= the filename submitted by the user from our form Thatsit. You just ran MATLAB using PHP Foundthis useful? Do you have comments or possible improvements to thisexample? Please leave your comments at the bottom. Notes Onething that is immediately apparent is that at no time can MATLAB beseen running while the above code executes. This is because PHP runsas a module of an Apache service. Vista (and maybe other systemstoo) has a security layer that deals with how services interact withthe desktop. The problem is better described here. |
GMT+8, 2025-3-13 09:27 , Processed in 0.041095 second(s), 17 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.