duancu4731 2014-10-16 13: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 15: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

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

报告相同问题?

悬赏问题

  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘