필터 지우기
필터 지우기

Matlab function executed by php(find the output)

조회 수: 2 (최근 30일)
lu mengping
lu mengping 2016년 8월 12일
댓글: lu mengping 2016년 8월 19일
I had try system(),exec(),shell_exec(),passthru(), but there are no output echo. just display 0 or Array
Matlab m-file
function output = test(a,b)
output=a+b;
end
php
<?php if($_POST["submit"]=="add"){
$one= $_POST["item"];
$two= $_POST["item2"];
$n_one = (int)$one;
$n_two = (int)$two;
$command = "E:\Matlab\bin\matlab -wait -nojvm -nodesktop -nodisplay -r \"test($n_one,$n_two);exit;\"";
//system($command,$rt);
//echo $rt;
//exec("$command 2>&1",$output,$rt);
//echo $output.'or'.$rt;
//$out = shell_exec($command);
//echo $out;
//passthru($command,$return_var);
//echo $return_var;
}
?>

답변 (1개)

Swathik Kurella Janardhan
Swathik Kurella Janardhan 2016년 8월 16일
You can refer to the first two answers in this link that explains on the syntax to execute the command and retrieve the output.
You might be missing '&' when referring to $output, try the below commands as mentioned in the link above.
exec("$command 2>&1",&$output,&$rt);
echo $output[0]."\n";
  댓글 수: 1
lu mengping
lu mengping 2016년 8월 19일
When I added '&',had HTTP 500 error web->Fatal error: Call-time pass-by-reference has been removed If I need to modify my function?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Application Deployment에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by