0
时候当我打电话MATLAB从PowerShell中,它工作正常:返回值调用Matlab
$command = "path-to-matlab.exe"
$args = "-nosplash -nodesktop -r run('path-to-my-mfile.m');exit();"
$process = Start-Process -Wait -PassThru $command $args
write-output $process.ExitCode
然而,当有一个在MATLAB的错误,怎么能PowerShell的知道吗?
我试过了从MATLAB的exit(1)
,但变量$process.ExitCode
仍然返回0
。
我也试过从MATLAB内部fprintf('some error message')
,但它不打印到PowerShell控制台,但只打印在MATLAB窗口。