Run Python outside of Matlab
4 次查看(过去 30 天)
显示 更早的评论
I am developing a Matlab interface for a Python program that accepts command line inputs. I want to use Matlab to prepare the inputs and call the program. When I feed the inputs to system() or dos(), the program appears to start (some of the output in in the command window is correct) but it doesn't run. If I use those same inputs in a terminal (cmd.exe) then the program runs as intended. I don't need the program to run inside of Matlab, the outputs are going to several different files that I can load later. Is it possible to use Matlab to call a program to run external to Matlab?
0 个评论
采纳的回答
Rik
2021-6-8
In such cases I tend to write .bat files and start them:
system(['start "" "' fn '"']);
%The first "" is required, because otherwise the file name is treated as
%the window title.
2 个评论
Rik
2021-6-8
You're welcome.
You could also try without the start to make the system call hang until the execution of the .bat completes. Depending on the root cause of the issue you were having, that might also work.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Python Package Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!