![]() |
如何从Linux命令行调用MATLAB函数?
基本上我有一个m文件,看起来像
function Z=myfunc() % Do some calculations dlmwrite('result.out',Z,','); end 我只想从命令行执行它而不进入MATLAB。我尝试了几个选项( -nodisplay , -nodesktop , -nojvm , -r等),它们都-nojvm 。我最终进入MATLAB,必须输入“ quit”退出。 解决办法是什么? [B]回答:[/B] [URL="http://en.wikipedia.org/wiki/MATLAB"]MATLAB[/URL]可以运行脚本,但不能从命令行运行函数。这是我的工作: 文件matlab_batcher.sh : #!/bin/sh matlab_exec=matlab X="${1}(${2})" echo ${X} > matlab_command_${2}.m cat matlab_command_${2}.m ${matlab_exec} -nojvm -nodisplay -nosplash < matlab_command_${2}.m rm matlab_command_${2}.m 输入以下内容进行调用: ./matlab_batcher.sh myfunction myinput [url=https://stackoverflow.com/questions/2001183]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 05:00。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.