bugGNU Octave - Bugs: bug #55666, Variable editor can only show row...

 
 

bug #55666: Variable editor can only show row struct arrays

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Thu 07 Feb 2019 01:34:18 PM UTC
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * 5.0.91 Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Fri 08 Feb 2019 05:01:32 PM UTC, comment #14: 

Also works with column struct (2x1)

Philip Nienhuis <philipnienhuis>
Project Member
Fri 08 Feb 2019 04:58:47 PM UTC, comment #13: 

On my box (windows 7), with your first patch in comment #9, I get the attached picture.
Looks good to me, what am I missing?

Maybe try with a 2x1 column struct array rather than a 1x2 row struct array?

All patches here don't fix bug #55668


Philip Nienhuis <philipnienhuis>
Project Member
Fri 08 Feb 2019 04:29:59 PM UTC, comment #12: 

I pushed an even simpler one-line patch to the stable branch (https://hg.savannah.gnu.org/hgweb/octave/rev/1c3471ce9a46).

Unfortunately, this does not resolve bug #53858 as Torsten hoped.

Rik <rik5>
Project Administrator
Fri 08 Feb 2019 10:34:23 AM UTC, comment #11: 

Patch works

Philip Nienhuis <philipnienhuis>
Project Member
Thu 07 Feb 2019 09:09:08 PM UTC, comment #10: 

Thanks Torsten I'll try to report back tomorrow.

Philip Nienhuis <philipnienhuis>
Project Member
Thu 07 Feb 2019 08:30:48 PM UTC, comment #9: 

Attached is a quick patch.  Seems to work on the example in this report.

(file #46207)

Rik <rik5>
Project Administrator
Thu 07 Feb 2019 08:28:45 PM UTC, comment #8: 

(@ comment #3) Matlab, as Octave, shows a row struct array the same as a column struct array, as described in bug #55668 comment #0 last but one paragraph; Array items vertical, fields horizontal.

Philip Nienhuis <philipnienhuis>
Project Member
Thu 07 Feb 2019 08:21:15 PM UTC, comment #7: 

The issues seems to be above the code in variable-editor-model.cc.

I took a look at the function header_fields(), and it is only getting called once when the size is 3x1.  The class vector_struct_model uses column to refer to the fieldname in the struct.  However, it appears that whatever loop is above struct_vector_class is looping over columns of the physical size.

In the constructor for struct_vector_class, we specifically change data members to have the right sizes.

      m_data_rows = val.numel ();
      m_data_cols = val.nfields ();

So, how does header_fields get called?

Rik <rik5>
Project Administrator
Thu 07 Feb 2019 08:19:35 PM UTC, comment #6: 

should be: ... 3x3 array, sorry :-)

Philip Nienhuis <philipnienhuis>
Project Member
Thu 07 Feb 2019 08:18:27 PM UTC, comment #5: 

A true 2x2 array ("struct matrix") is shown as a matrix containing 1x1 structs (see attached pic).
The vector representation is obviously chosen as a gesture for users, but gets confusing is a row vector is shown as a column.


Philip Nienhuis <philipnienhuis>
Project Member
Thu 07 Feb 2019 06:43:37 PM UTC, comment #4: 

The cause of this issue might the same as the one of the crash described in bug #53858 (or at least the effect mentioned in comment #5 there).

Torsten Lilge <ttl>
Project Member
Thu 07 Feb 2019 06:07:41 PM UTC, comment #3: 

Also, does Matlab use the same format for row versus column struct arrays?  What does it look like?

The code for this looks to be in libgui/src/variable-editor-model.cc.  There is a class called vector_struct_model that is meant to display a struct array vector.

Rik <rik5>
Project Administrator
Thu 07 Feb 2019 05:52:50 PM UTC, comment #2: 

How does Matlab display a true, 2-D struct array?

For example,

tst = repmat (struct ('a', 1, 'b', rand(3)), 3, 3)
openvar tst

In Octave, this is a 3x3 array where each element is a 1x1 struct which seems reasonable.

Rik <rik5>
Project Administrator
Thu 07 Feb 2019 05:42:54 PM UTC, comment #1: 

Confirmed.  And it appears on Linux as well so this isn't related to OS.

Rik <rik5>
Project Administrator
Thu 07 Feb 2019 01:34:18 PM UTC, original submission:  

Steps to reproduce:

>> tst = repmat (struct ("a", 1, "b", rand(3)), 3, 1)
    tst =
      3x1 struct array containing the fields:
        a
        b
>> openvar ('tst')

gives attached VE_struct_3x1.bug_A.png. Only field "a" is shown. It isn't possible to explore field "b" by clicking around in it.

Then,

>> tst = repmat (struct ("a", 1, "b", rand (3)), 1, 3)
    tst =
      1x3 struct array containing the fields:
        a
        b
>> openvar ('tst')

.. followed by double-clicking in field tst(2).b gives attached pic VE_struct_1x3_OK.png.

However, with the Variable editor untouched, now again typing:

>> tst = repmat (struct ("a", 1, "b", rand(3)), 3, 1)
    tst =
      3x1 struct array containing the fields:
        a
        b
>> openvar ('tst')

gives VE_struct_3x1.bug_B.png, where field b is updated.

Philip Nienhuis <philipnienhuis>
Project Member

 

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

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-08 philipnienhuis Attached File- Added VE_bug53858_after_patch#1_bug55666.PNG, #46216
    2019-02-08 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2019-02-07 rik5 Attached File- Added bug55666.diff, #46207
    2019-02-07 philipnienhuis Attached File- Added ML3x3matrix-in-Ve.PNG, #46206
    2019-02-07 rik5 Item GroupUnexpected Error or Warning Incorrect Result
        StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
    2019-02-07 philipnienhuis Attached File- Added VE_struct_3x1.bug_A.png, #46200
        Attached File- Added VE_struct_1x3_OK.png, #46201
        Attached File- Added VE_struct_3x1.bug_B.png, #46202

    Back to the top


    Powered by Savane 3.9