i have to execute matlab function using php. can any one tell me the way of doing it. and the sample codes for it.

댓글 수: 3

Anushan Vasantharajah
Anushan Vasantharajah 2017년 2월 27일
편집: Guillaume 2017년 2월 27일
$data= "Anushan";
echo $data;
$startDir = "C:\\wamp64\\www\\pdpSystem";
$cmd = "matlab -sd " . $startDir . " -r test('img (1).jpg')";
$result = exec($cmd);
var_dump($result);
// Decode the result
$resultData = json_decode($result, true);
print_r($resultData);
// This will contain: array('status' => 'Yes!')
var_dump($resultData);
I tried this code to execute it. but it didn't work. i m new to matlab. i m doing this for my final year project. please help me. thanks in advance.
Guillaume
Guillaume 2017년 2월 27일
편집: Guillaume 2017년 2월 27일
Please use the {} Code button to format code as such (I've done it for you but please fix the indentation).
"it didn't work." is a useless statement. In what way did it not work? Gave a wrong result (if so, what did you expect and what did you get?), gave an error (if so, what is the error?), something else?
Also, it would be useful to know the content of test.m.
if true
% my php code
public function connectMatlab(){
$data= "Anushan";
echo $data;
$startDir = "C:\\wamp64\\www\\pdpSystem";
$cmd = "matlab -sd " . $startDir . " -r test('img (1).jpg')";
$result = exec($cmd);
var_dump($result);
}
end
if true
% matlab test.m code
function [] = test(fileName)
x = fileName;
disp(x);
end
end
this is my code. sorry i m not familier with this. now only i m trying to learn it.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2017년 2월 27일

댓글:

2017년 2월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by