Read a .mat file and write .csv without opening matlab
显示 更早的评论
I would like to read a ".mat" file and write it out as ".csv" file without opening matlab.
Basically this:
M = dlmread('FileName.mat', '\t', 1, 0);
csvwrite('FileName.csv', M)
but then without opening matlab.
I'm using linux command line.
Thanks!
采纳的回答
更多回答(2 个)
Michael02139
2016-10-25
0 个投票
2 个评论
Marc Jakobi
2016-10-25
That was all about writing a CSV file. Loading a MAT file should be trivial:
load('matFileName.mat')
If you don't know which variables are contained in the mat file, you can load it into a struct:
S = load('matFileName.mat');
varNames = fieldnames(S);
etc.
Michael02139
2016-10-25
Walter Roberson
2016-10-25
0 个投票
Is the mat file text with tab delimiters or is it a binary file created by save()?
If it is text with tab delimiters then consider just using sed to change the tabs into comma
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!