Execute Matlab Function by PHP

I am trying to execute a simple matlab function with input and output but it returns, even I only check the version of matlab
string '' (length=0)
array (size=0)
empty
int 1
my php code(check version)
$command = 'matlab -version';
$res = exec($command, $output, $return);
var_dump($res, $output, $return);
my php code(real work)
$command = "matlab -nojvm -nodesktop -nodisplay -r test (1,2,3)";
$res = exec($command, $output, $return);
var_dump($res, $output, $return);
Matlab code
function x = test(n1,n2,n3)
x = n1+n2+n3;
end

Réponses (1)

Walter Roberson
Walter Roberson le 11 Oct 2015

0 votes

$command = "matlab -nojvm -nodesktop -nodisplay -r 'test(1,2,3)'";

1 commentaire

Tsz Hei Yeung
Tsz Hei Yeung le 11 Oct 2015
It doesn't work too
Do I need to setup a matlab server, besides the wamp server?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by