Read a .mat file and write .csv without opening matlab
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (2)
Michael02139
el 25 de Oct. de 2016
0 votos
2 comentarios
Marc Jakobi
el 25 de Oct. de 2016
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
el 25 de Oct. de 2016
Walter Roberson
el 25 de Oct. de 2016
0 votos
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
1 comentario
Michael02139
el 25 de Oct. de 2016
Categorías
Más información sobre Standard File Formats en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!