from python to matlab
显示 更早的评论
I do not know how to send variables defined in python to MATLAB.
If you define A = 2 in python,
how does A = 2 in the MATLAB workspace Can you move it?
采纳的回答
更多回答(2 个)
Loretta Laughrey
2020-5-20
0 个投票
Just pass the variable in a function call:
In Python:
eng = matlab.engine.start_matlab("-desktop")
eng.cd(myscripts, nargout=0) # change to the folder with the scripts
results = eng.mymatlabscript(self.A, self.B, nargout = 0, async = False)
In MATLAB
function mymatlabscript(A, B)
类别
在 帮助中心 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!