bugGNU Octave - Bugs: bug #57919, Octave's visualization of...


bug #57919: Octave's visualization of structures can be improved

Submitted by:  José Luis García Pallero <jgpallero>
Submitted on:  Fri 28 Feb 2020 02:19:45 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev 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 17 Mar 2020 09:10:41 PM UTC, comment #2: 

I have to second this, Octave's output for a structure of any depth or significant size is useless because it is far too verbose.

I once wrote a function that printed a structure more compactly, like this:

>> dispstruct (struct ('a', rand(50), 'b', 1, 'c', 2, 'd', [4,5,6,7], 'e', 'text', 'f', 8, 'g', 9, 'h', 10, 'i', 11, 'j', struct('f1', 1)))
Nonscalars and non character arrays:
Field: a        [50 50]        double        [ 0.744608, 0.186078, 0.316489, 0.54813, ... ]
Field: d        [1 4]        double        [ 4, 5, 6, 7, ... ]
Field: j        [1 1]        struct
Scalar fields and character arrays:
     Field |   Contents |      Field |   Contents |      Field |   Contents |      Field |   Contents
         b |          1 |          c |          2 |          e |       text |          f |          8
         g |          9 |          h |         10 |          i |         11 |            |

Happy to share if it's of interest.

Richard <crobar>
Fri 28 Feb 2020 06:37:34 PM UTC, comment #1: 

As a very small start, it would be nice to use a colon ':' to separate the field from the value to emphasize that this is a structure.

Rik <rik5>
Project Administrator
Fri 28 Feb 2020 02:19:45 PM UTC, original submission:  

A structure in Octave is shown on screen as

>> a.a=3;a.b='Hello';a.c=[1 2;3 4]
a =

  scalar structure containing the fields:

    a =  3
    b = Hello
    c =

       1   2
       3   4

i.e., all fields are expended, while the behavior in Matlab is

>> a.a=3;a.b='Hello';a.c=[1 2;3 4]

a =

  struct with fields:

    a: 3
    b: 'Hello'
    c: [2×2 double]

i.e., when a field is a matrix only the name and dimensions are indicated, but not expanded.

I find the Matlab behavior more practical than the Octave one because it makes easier to see how many fields there are and their names. It would be nice if Octave's behavior where as the Matlab one for the structs.

José Luis García Pallero <jgpallero>


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

Attach Files:

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 crobar (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jgpallero (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.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5