bugGNU Octave - Bugs: bug #60806, Usability enhancement - include...

 
 

bug #60806: Usability enhancement - include usage instructions in files generated by save

Submitted by:  Tasos Papastylianou <tpapastylianou>
Submitted on:  Mon 21 Jun 2021 10:47:34 AM UTC  
 
Category:  Interpreter Severity:  1 - Wish
Priority:  1 - Later Item Group:  Feature Request
Status:  Need Info Assigned to:  None
Originator Name:  Tasos Papastylianou Open/Closed:  Open
Release:  6.2.0 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 22 Jun 2021 09:06:45 PM UTC, comment #1: 

Try 'help save_header_format_string'.  There is already an internal variable that can be set by the user to be the header for text files.

This works for me:

curr_hdr = save_header_format_string ();
new_hdr = strcat (...
"# This data-containing file has been generated via the octave 'save' command.\n",
"# Use the 'load' command to add its contents to a new session.\n",
"#\n",
curr_hdr);
save_header_format_string (new_hdr);
x = pi;
save -text tst.var x

Rik <rik5>
Project Administrator
Mon 21 Jun 2021 10:47:34 AM UTC, original submission:  

This feature request is inspired by this question on stackoverflow: https://stackoverflow.com/questions/68056408/how-to-get-specific-data-drom-text-in-octave

Effectively, one of the more subtle differences between octave and matlab, is how the 'save' command works:

 • matlab generally results in the creation of a binary file with the '.mat' extension, unless otherwise specified (which is uncommon).

 • octave does not enforce a particular extension, and defaults to 'text' mode

This creates an odd situation, where a textfile containing octave data, which has been created via the 'save' command in octave, seems like an arbitrary text file to the user, who then tries to write code to parse it, and it's not obvious that it can simply be 'loaded'.

From a usability point of view, it might be worth including in the comment-header of that file a small addition, effectively letting the user know that this is a file generated by the 'save' command and can be loaded in octave using the 'load' command.

In other words, instead of, say:

# Created by Octave 6.2.0, Mon Jun 21 11:35:12 2021 BST <tasos@tasos-lenovo>
# name: a
# type: scalar
1


# name: b
# type: scalar
2

change this to, say:

# This data-containing file has been generated via the octave 'save' command.
# Use the 'load' command to add its contents to a new session.
#
# Created by Octave 6.2.0, Mon Jun 21 11:35:12 2021 BST <tasos@tasos-lenovo>
# name: a
# type: scalar
1


# name: b
# type: scalar
2

Tasos Papastylianou <tpapastylianou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by tpapastylianou (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-29 rik5 Severity3 - Normal => 1 - Wish
        Priority5 - Normal => 1 - Later
    2021-06-22 rik5 StatusNone => Need Info

    Back to the top


    Powered by Savane 3.6