I am trying to connect MATLAB with PHP that can calculate fuzzy logic. However it cannot run the matlab function and it did not show the output on my php website that has been calculated in MATLAB.
Any help would be greatly appreciated.
<html>
<?php
$Weight = $_POST['Weight'];
$Height = $_POST['Height'];
$BM;
//CALCULATION FOR BMI
function BM($Weight, $Height)
{
$BM = ($Weight/(($Height/100)*($Height/100)));
return $BM;
}
$BMI = BM($Weight,$Height);
$DailyActivity = $_POST['DailyActivity'];
$CalorieIntake = $_POST['CalorieIntake'];
$Input5= $_POST['Input5'];
$x1 = exec("\"C:\Program Files (x86)\MATLAB\MATLAB Production Server\R2015a\bin/matlab.exe\" -wait -nodesktop -noFigureWindows -nosplash ^ -r \"fuzzyExpert({$BMI},{$DailyActivity},{$CalorieIntake},{$Input5});quit;\" ");
$myfile = fopen("C:\Users\USER\Documents/fuzzy/testoutput.txt", "r") or die("Unable to open file!");
$result = fgets($myfile);
fclose($myfile);
?>
<body>
<br>
MATLAB RESULT: <?php echo $result; ?>
</body>
</html>