无法从php运行matlab脚本
我的php脚本执行一个matlab脚本。php脚本是打开.m文件的简单代码无法从php运行matlab脚本,php,matlab,Php,Matlab,我的php脚本执行一个matlab脚本。php脚本是打开.m文件的简单代码 // phpcreatefile.php $command = '/Applications/MATLAB_R2014b.app/bin/matlab phpcreatefile.m'; proc_open($command, $descriptorspec, $pipes); m文件是生成随机数文本文件的简单代码 function phpcreatefile() fid = fopen('test.txt', 'wt
// phpcreatefile.php
$command = '/Applications/MATLAB_R2014b.app/bin/matlab phpcreatefile.m';
proc_open($command, $descriptorspec, $pipes);
m文件是生成随机数文本文件的简单代码
function phpcreatefile()
fid = fopen('test.txt', 'wt');
for i = 1:100
randNumber = [num2str(rand(1)) '\n'];
fprintf(fid, randNumber);
end
fclose(fid);
quit force
当我运行命令php phpcreatefile.php时,我会得到以下错误日志
Error writing to output stream.
Error writing to output stream.
Error writing to output stream.
Error writing to output stream.
{ : matlabpath
Error writing to output stream.
: matlabrc (line 75)
matlabpath([oldPath osPathsep matlabpath])
}
在matlab应用程序中运行时,matlab代码本身运行良好。是什么导致了这里的错误?为什么不使用exec执行系统命令?。使用exec执行matlab命令,因为我无法使用exec获得错误输出。据我所知,proc_open与执行命令行的作用相同。