Is there a way to include a header comment for a mat file?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Scientists often have a lot of scripts which run particular analyses, and running doc on a directory is a great way to get a summary of what all the scripts/functions do:
>> doc('Max_1h_prcp')
Contents of Max_1h_prcp:
...
But for those mat files, well the summary is not so useful.
Is there any way to add a comment to a mat file, so it shows up in doc?
If not, would this be a function anyone else would like?
0 comentarios
Respuestas (1)
Walter Roberson
el 18 de Sept. de 2020
Unfortunately v4 and v5 and v7 mat files were not defined to allow for comments. The exception is that the first 128 bytes of v5 and v7 files is text and that everything after naming the version is ignored, so about 110 bytes are available.
In theory Mathworks could extend the v5 and v7 header to include a comment marked as such, but doing so would cause backwards compatibility problems.
v7.3 mat files are hdf5 files, and that standard has no provision for file comments. The standard does have an Object Comment that can be applied to each data object, but there is not one for the file level as far as I can see.
I suspect that the easiest approach would be to designate a particular variable name to store in the file as a file description, and to write a small wrapper that checks the file for that variable and pulls it out and displays it if present. You would need to decide between char() vs string() vs cell array of character vectors.
0 comentarios
Ver también
Categorías
Más información sobre HDF5 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!