运行外部程序的Matlab会突然结束,并显示以下奇怪的状态代码:-1.0737e+09

bt1cpqcv  于 8个月前  发布在  Matlab
关注(0)|答案(1)|浏览(85)

我不能在matlab中使用系统或dos函数运行外部命令,它以一个奇怪的状态码结束!

‍‍system(dosCommand)

ans =

  -1.0737e+09
bf1o4zei

bf1o4zei1#

在这里得到了回答:https://www.mathworks.com/matlabcentral/answers/408044-what-is-the-difference-between-a-system-call-from-matlab-using-system-and-a-command-in-a-cmd-ter#answer_354381
您需要运行system('path')来查看路径上的matlab目录

>> system('path');
PATH=C:\Program Files\MATLAB\R2022b\bin\win64;; # shortened for brevity
>>

然后像这样运行命令:

>> system(['set path=%path:C:\Program Files\MATLAB\R2022b\bin\win64;=% & ' dosCommand]);

相关问题