duanpao4522 2017-08-30 10:17
浏览 50

从php获取matlab独立应用程序输出

I have converted my .m file into a standalone application with the aid of deploytool.

Now, I want to run my application and get the outputs using PHP. I can run my application on cmd. And it will return the outputs and print. But I can not get the outputs from PHP.

this is the main file of my standalone application:

function [onsets,pitch,endpoint] =  matxtwavtomidi( input_args )

input=strsplit(input_args);
[s wavFs] = audioread(input{1});
[onsets,pitch,endpoint]=txtwavtomidi(s);

end

this is the result I get from cmd:

C:\Users\user> START /WAIT D:/java/matlab/matxtwavtomidi.exe D:/song.wav

onsets =
    1.7183
    1.7183
    2.3220
    2.3220

pitch =
    60
    72
    62
    74

endpoint =
    1.8576
    1.9040
    3.0650
    2.4149

this is my PHP:

<?php
$stringcmd= "START /WAIT D:/java/matlab/matxtwavtomidi.exe ";
$stringwav = "D:/song.wav";

exec($stringcmd.$stringwav, $output, $return_var);

echo $stringcmd.$stringwav;
var_dump($output);
var_dump($return_var);

?>

this is the result from php:

START /WAIT D:/java/matlab/matxtwavtomidi.exe D:/song.wav
array(0) { }
int(0)

Everytime when i run the application on cmd, it will always show the application's icon picture in the middle of the screen for 2 seconds and then disappear.

And when I run my PHP, it did show the icon picture,so I think it did run the application. And there are no error in php_error_log and apache error_log.

My problem is,why can't my PHP get the outputs of the application from cmd? And how to solve this problem?

(Sorry for my poor English..)

  • 写回答

1条回答 默认 最新

  • douyue5856 2017-08-30 11:25
    关注

    One good solution is to write your data from matlab to a .txt file and then read that file from your server side.. Hope it helps

    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器