我在 matlab 中有代码,我想在 python 代码中使用其结果(作为矩阵或.dat文件)。谁能告诉我这是怎么做到的?
NumPy和SciPy可以直接使用scipy.io.loadmat
和scipy.io.savemat
读写MATLAB .mat文件。
.dat文件只是一个文本文件:
fid = fopen('outputFile.dat', 'wt');
fprintf(fid, your_data_in_string_format);
fclose(fid);