Large data file I/O
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to speed up a bottle neck in our code. Currently, the output of one of our FORTRAN modules writes the data to a text file. The text file is saved as .m file. The m files is then loaded into MATLAB. An example would be
function x = my_data(x)
x.time = [LARGE AMOUNT OF DATA]
Now this read operation seems to cause MATLAB to run out of memory. The MATLAB help file suggests storing large amounts of data in MAT files because they are optimized for read/write operations and compress data as well. They say this is better than using low-level file I/O such as fopen. But since our data is being read as an “.m” is it still using such file I/O. My question is should we take the time to try to write that data from FORTRAN as a mat file instead of a “.m”.
0 comentarios
Respuesta aceptada
Walter Roberson
el 17 de En. de 2012
It appears to me that you would be better off writing a binary file. The speed might not be as good as a .mat file (because of no compression), but Fortran should have no problem writing a binary file whereas bringing in the .mat format can be a nuisance.
I would also suggest that it would be faster if you used
x.time = my_data(); %no argument
and
function times = my_data
times = fread(...);
end
This would avoid having to make a copy of x.
Más respuestas (0)
Ver también
Categorías
Más información sobre Fortran with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!