我不能在matlab中使用系统或dos函数运行外部命令,它以一个奇怪的状态码结束!
system(dosCommand) ans = -1.0737e+09
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')
>> 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]);
1条答案
按热度按时间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目录然后像这样运行命令: