Converting numpy arrays in python to .mat in matlab
335 ビュー (過去 30 日間)
古いコメントを表示
I have a 2D numpy array in python and I want to image this array in matlab using 'imagesc()'. I was trying to convert the array to Pandas DataFrame and then to export it as .csv file so that I can load it in matlab. But I feel there is an easier way than this. Ultimately what I want is to convert my python array to matlab matrix.
0 件のコメント
採用された回答
Ameer Hamza
2020 年 10 月 21 日
編集済み: Ameer Hamza
2020 年 10 月 21 日
You can directly save to a .mat file using savemat() from scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.savemat.html
Alternatively, you can also read about calling python functions from MATLAB: https://www.mathworks.com/help/matlab/call-python-libraries.html
2 件のコメント
その他の回答 (1 件)
abraham rodriguez
2021 年 9 月 18 日
In latest R2021a, you can pass a python numpy ndarray to double() and it will convert to a native matlab matrix, even when calling in console the numpy array it will suggest at the bottom "Use double function to convert to a MATLAB array"
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!