我在Windows 7 SP1 64位计算机上运行WAMP Server 2.5(32位)和PHP 5.5.12。 我正在运行Matlab R2014b。
我试图通过PHP执行Matlab。
Matlab函数phptest.m如下:
function phptest % Open file fid = fopen('success.txt', 'wt'); %Print a test string fprintf(fid, 'Test matlab function'); % Close file fclose(fid); % Quit MATLAB quit force当我从命令提示符执行时:
matlab -wait -nosplash -sd "C:\wamp\www\testMatlab" -logfile logfile.txt -r "phptest;"代码运行没有问题,并创建文件'sucess.txt'。
但是,如果我尝试通过php文件执行:
<?php $testStr = 'matlab -wait -nosplash -sd "C:\wamp\www\testMatlab" -logfile logfile.txt -r "phptest;"'; exec($testStr); echo("Done!"); ?>日志文件显示以下错误:
严重:检查许可证时出错
任何帮助,将不胜感激。
I am running WAMP Server 2.5 (32-bit) with PHP 5.5.12 on a Windows 7 SP1 64-bit machine. I am running Matlab R2014b.
I am trying to execute Matlab via PHP.
The Matlab function phptest.m is as follow:
function phptest % Open file fid = fopen('success.txt', 'wt'); %Print a test string fprintf(fid, 'Test matlab function'); % Close file fclose(fid); % Quit MATLAB quit forceWhen I execute from the command prompt:
matlab -wait -nosplash -sd "C:\wamp\www\testMatlab" -logfile logfile.txt -r "phptest;"the code runs without problems and the file 'sucess.txt' is created.
However, if I try to execute via a php file:
<?php $testStr = 'matlab -wait -nosplash -sd "C:\wamp\www\testMatlab" -logfile logfile.txt -r "phptest;"'; exec($testStr); echo("Done!"); ?>The logfile shows the following error:
Severe: Error checking out license
Any help would be appreciated.
最满意答案
您可以通过使用-c标志运行MATLAB来强制使用特定的许可证文件:
'matlab -c "path/to/license" -wait -nosplash -sd "C:\wamp\www\testMatlab" -logfile logfile.txt -r "phptest;"';matlab -c licensefile使用指定的许可证文件启动MATLAB。 licensefile参数可以具有port @ host形式,也可以是以冒号分隔的许可证文件名列表。 此选项会导致忽略LM_LICENSE_FILE和MLM_LICENSE_FILE环境变量。
请参阅: http : //www.mathworks.nl/help/matlab/ref/matlabwindows.html
You can force MATLAB to use a specific license file by running it with the -c flag:
'matlab -c "path/to/license" -wait -nosplash -sd "C:\wamp\www\testMatlab" -logfile logfile.txt -r "phptest;"';matlab -c licensefile starts MATLAB using the specified license file. The licensefile argument can have the form port@host or it can be a colon-separated list of license filenames. This option causes the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables to be ignored.
See: http://www.mathworks.nl/help/matlab/ref/matlabwindows.html
更多推荐
发布评论