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 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用