File extensions for formats supported by save()

I am currently working on a patch for allowing to select the save format when saving a variable in the variable editor. What are the commonly used file extension for the different formats supported by save ()?

According to the documentation of save in Octave 6.1, the following formats are supported. There are no documented default extensions, so in principal any file extension would do.
The file extensions here are just a suggestion:

  • -ascii: .txt (I’m not sure this is a good choice. Maybe better .csv even if the file uses space (not comma) as a separator.)
  • -binary, -float-binary: .dat
  • -hdf5, -float-hdf5: .h5
  • -text: .odat (To indicate that this is a format specific to Octave?)
  • -v7, -v6, -v4 (and synonyms): .mat (Those are formats that should be compatible to Matlab.)

I’m not sure if files that are compress with gzip should have a dedicated extension. I also don’t know if you plan on adding that to the export options in the interface.

Markus, thanks for the suggestions.

  • Currently, saving a variable always uses the default format and a file name *.txt is suggested (not implemented by me). Therefore, maybe .txt is commonly used for -text'?
  • The -zip format can also be selected, I suggest txt.gz or whatever we chose for -text followed by .gz.
  • If we chose .txt for -text maybe .dat is a good choice for -ascii since this extension is also used for data files in, e.g., gnuplot tutorials

Sounds reasonable to me.
If we use those, maybe we should use .bin for the binary formats to distinguish them from the -ascii format files.

I have pushed the patch with suggested extensions as discussed (including .bin).