MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   有什么方法可以在Perl中读取MATLAB的.mat文件吗? (https://www.labfans.com/bbs/showthread.php?t=23279)

poster 2019-12-10 20:30

有什么方法可以在Perl中读取MATLAB的.mat文件吗?
 
我在[URL="http://en.wikipedia.org/wiki/MATLAB"]MATLAB[/URL]中生成了一些要使用Perl处理的数据。我将来自MATLAB的数据保存在.mat文件中。有没有办法在Perl中阅读它?



[B]回答:[/B]

一种选择是使用以下方法从MATLAB内部将二进制MAT文件另存为ASCII:

load('test_data.mat'); save('test_data.asc', 'var1', 'var2', '-ascii'); 这样,您将可以在Perl中处理ASCII数据。

如果您需要一个完全用Perl编写的解决方案,那么您应该能够使用CPAN上的[URL="http://search.cpan.org/perldoc?Math::Matlab"]Math :: MATLAB[/URL]软件包来自动化该过程。

注意:如果可以选择使用Python,则可以使用[URL="https://stackoverflow.com/questions/874461"]SciPy Python库中[/URL]的[URL="http://www.scipy.org/doc/api_docs/SciPy.io.mio.html#loadmat"]loadmat[/URL]函数。



[url=https://stackoverflow.com/questions/2594022]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 05:02

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.