'C:\Prediction.exe' 在 MATLAB 中不是内部或外部命令,也不是可运行的程序或批处理文件
'C:\Prediction.exe' is not recognized as an internal or external command, operable program or batch file in MATLAB
我有一个测试程序:
function [y, yy] = Prediction(x)
y = x * rand();
yy = x + rand();
end
然后,我把它编译成.exe
文件。现在,我正在使用以下命令将 Prediction.exe
调用到 MATLAB 中:
system('C:\Prediction.exe 5')
不幸的是,我收到一个错误:
'C:\Prediction.exe' is not recognized as an internal or external
command, operable program or batch file.
ans =
1
我找不到解决方法。请指导我,这是将带有 inputs/outputs 的 *.exe
调用到 MATLAB 中的正确方法吗?
使用语法时
system('C:\Prediction.exe 5')
return 值是您执行的命令的退出状态。通常,如果执行成功则为 0
,否则为 non-zero。
status = system(command)
calls the operating system to execute the
specified command. The operation waits for the command to finish
execution before returning the exit status of the command to the
status variable.
要获得在命令行键入命令时会看到的输出,您需要使用不同的语法:
[status,cmdout] = system(command)
also
returns the output of the command to cmdout. This syntax is most
useful for commands that do not require user input, such as dir
.
[status,cmdout] = system(command,'-echo')
also displays (echoes) the
command output in the MATLAB® Command Window. This syntax is most
useful for commands that require user input and that run correctly in
the MATLAB Command Window.
为了从您的函数中获得此输出,我认为您需要 output the values using printf。
我有一个测试程序:
function [y, yy] = Prediction(x)
y = x * rand();
yy = x + rand();
end
然后,我把它编译成.exe
文件。现在,我正在使用以下命令将 Prediction.exe
调用到 MATLAB 中:
system('C:\Prediction.exe 5')
不幸的是,我收到一个错误:
'C:\Prediction.exe' is not recognized as an internal or external command, operable program or batch file.
ans =
1
我找不到解决方法。请指导我,这是将带有 inputs/outputs 的 *.exe
调用到 MATLAB 中的正确方法吗?
使用语法时
system('C:\Prediction.exe 5')
return 值是您执行的命令的退出状态。通常,如果执行成功则为 0
,否则为 non-zero。
status = system(command)
calls the operating system to execute the specified command. The operation waits for the command to finish execution before returning the exit status of the command to the status variable.
要获得在命令行键入命令时会看到的输出,您需要使用不同的语法:
[status,cmdout] = system(command)
also returns the output of the command to cmdout. This syntax is most useful for commands that do not require user input, such asdir
.
[status,cmdout] = system(command,'-echo')
also displays (echoes) the command output in the MATLAB® Command Window. This syntax is most useful for commands that require user input and that run correctly in the MATLAB Command Window.
为了从您的函数中获得此输出,我认为您需要 output the values using printf。