0

I am trying to build the frontend for my app using HTML and CSS. I have IIS installed and am sending a request to a PHP script that needs to execute a Matlab code.

What the problem is?
I can not succesfully execute the Matlab code. I woud prefer to run the code through CMD.

What I've tried?
I've tried the following

(A)

exec(matlab -nodisplay -nojvm -logfile out.txt -r "[matlabfilename]; quit;");

Result: nothing happens, what I expect to see is the output of matlab program in out.txt. Out.txt contains the output of the program if I execute the above code on cmd but if I use the link in the web browser it becomes empty

(B) I've made a batch file of the cmd command that works and used

system("cmd /c C:\inetpub\wwwroot\beServer\prog.bat");

where prog.bat contains

matlab -nodisplay -logfile out.txt -r "main; quit;"

I've copied all matlab files I want to execute to C:\inetpub\wwwroot\beServer
Result:I see C:\inetpub\wwwroot\beServer>matlab -nodisplay -logfile out.txt -r "main; quit;" in the web browser but no changes in out.txt

ada2161
  • 147
  • 8
  • What does `out.txt` contain in the first case? – Daniel Jan 29 '16 at 15:10
  • nothing, it's blank. It will contain the output of the matlab program. For instance if I execute matlab -nodisplay -nojvm -logfile out.txt -r "fprintf(1, 'value: %f\n', 2.0); quit;" on cmd it contains 2 – ada2161 Jan 29 '16 at 15:12
  • http://stackoverflow.com/questions/4611195/how-to-call-matlab-from-command-line-and-print-to-stdout-before-exiting/4621554#4621554 – ada2161 Jan 29 '16 at 15:12
  • Your question contains the sentence "out.txt contains some output text" so I did not expect it to be empty. Please update your question and make it clear. – Daniel Jan 29 '16 at 15:16
  • done with the edit. Any suggestions? – ada2161 Jan 29 '16 at 15:24

0 Answers0