声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

声振论坛 展示 基础理论 查看内容

使用php在网页执行matlab

2012-10-18 06:57| 发布者: aspen| 查看: 14830| 评论: 0|原作者: Jillian|来自: 振动论坛

摘要: 目录 IncludingStartup Options in a Shortcut on Windows Systems SpecifyingStartup Options in the MATLAB Startup File CommonlyUsed Startup Options PassingPerl Variables on Startup Startupand Callin ...
http://narnia.cs.ttu.edu/drupal/node/41
RunningMATLAB without graphic interface
Interactiveover SSH
StartMATLAB using the command:
  1. matlab -nodisplay -nojvm
复制代码
Runninga MATLAB script over SSH
Inthis case, you don't even need a MATLAB Prompt to interact with.
  1. matlab -nodisplay -nojvm -r a_code > matlab.out
复制代码
YourMATLAB program should have the file name a_code.m (youcan change it to whatever name you like. But when you tell MATLAB torun it, omit the .m suffix.)The >matlab.out partredirects the output to a file rather than showing on your Linux/MacOS X terminal. This way is preferred because you have a record onwhat is happening.

Runninga MATLAB script with input variables over SSH
First,go to the directory containing the MATLAB script that defines thefunction (or, fancier, add that directory into MATLAB PATH byediting your MATLABPATH environment variable or pathdef.m file).Then, run like this
  1. matlab -nodisplay -nojvm -r "my_function(10)"
复制代码
Again,you can redirect the output to a file.
Youcan also write a Shell, Perl or Python script to do so. MATLAB givesan example using Perlat http://www.mathworks.com/help/techdoc/matlab_env/f8-4994.html

OnSun Grid Engine (SGE)-powered cluster
Writea job script below and submit it using qsub
  1. #!/bin/sh
  2. #$ -V
  3. #$ -cwd
  4. #$ -S /bin/bash
  5. #$ -N matlab
  6. #$ -o $JOB_NAME.o$JOB_ID
  7. #$ -e $JOB_NAME.e$JOB_ID
  8. #$ -q normal
  9. #$ -pe fill 12
  10. #$ -P hrothgar
  11. matlab -nodisplay -nojvm -r a_code > matlab.out
复制代码
YourMATLAB program should have the file name a_code.m.
Formore options on starting MATLAB, please refer to its official docat
http://www.mathworks.com/help/techdoc/ref/matlabunix.html

本文内容由 Jillian 提供

最新评论

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-24 21:57 , Processed in 0.051994 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部