0

I am writing a PHP script to fetch some values from XML. Now, I want to pass those values to Matlab. Is it possible to run matlab code in PHP script? If yes, do I need to have matlab installed in /var/www/html (I'm using Ubuntu)?

Anurag Mishra
  • 11
  • 1
  • 4

1 Answers1

1

This is how such a command would look in Windows:

<?php

$command='matlab -nodesktop -r "run emailToSpeech.m";';
exec ( $command );

?>

In this example, the .m script has to reside in the same directory as your PHP script, but MATLAB itself does not. (And you could always change directories if you prefer to do it that way.) I would expect Ubuntu to work similarly, although I haven't had a chance to try it yet.

The question linked below has a fuller discussion in case you want to explore further:

running MATLAB code from php

Community
  • 1
  • 1
dgoverde
  • 110
  • 2
  • 15