from python to matlab
1 回表示 (過去 30 日間)
古いコメントを表示
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?
採用された回答
Wiley Mosley
2019 年 8 月 2 日
編集済み: Wiley Mosley
2019 年 8 月 2 日
I believe you would want to utilize the matlab engine. If you are just trying to get the data in a format that you can then call a matlab function there are examples in the above link that should help you out.
You could possibly try sharing the session and maybe then variables in python would appear in the matlab workspace, but I have not tried this before.
その他の回答 (2 件)
Loretta Laughrey
2020 年 5 月 20 日
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)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!