duancu4731 2014-10-16 05:57
浏览 32
已采纳

从Wamp服务器执行时,Matlab返回许可证检出错误,但不是命令提示符

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 force

When 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.

  • 写回答

1条回答 默认 最新

  • douxieqiu0651 2014-10-16 07:09
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部