bugGNU Octave - Bugs: bug #47526, set with mixed struct and...

 
 

bug #47526: set with mixed struct and property-value-pairs errors

Submitted by:  Markus Mützel <mmuetzel>
Submitted on:  Thu 24 Mar 2016 05:58:45 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Sat 26 Mar 2016 05:08:50 AM UTC, comment #6:

I applied your patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/38c0c1f5cf57). I added the bug number to the commit message as this helps us track which changeset fixed a problem.

Rik <rik5>
Project Administrator
Thu 24 Mar 2016 11:24:48 PM UTC, comment #5:

Some more tests with Matlab:
This is working (3 patches in red, green and blue):

This fails:

The error is

To sum it up: Passing a cell of structs fails. Passing an array of structs does work. However, only the value in the last element is set.
This behavior is similar if the same property is set several times with property value pairs. The following will produce a blue patch:

Octave seems to behave the same.
The only thing that does not seem to work in Octave is passing a mix of structs and property value pairs. This case should be fixed with the patch without breaking the other cases.

Markus Mützel <mmuetzel>
Project Member
Thu 24 Mar 2016 08:45:56 PM UTC, comment #4:

Fascinating. So it appears that a mix is good, but a struct array is bad.

Rik <rik5>
Project Administrator
Thu 24 Mar 2016 08:19:41 PM UTC, comment #3:

A quick check in Matlab showed that the structs and property value pairs can be freely mixed. The following example works correctly:

As to mapping an array of structs to an array of handles: The following example turns all patches to blue:

Markus Mützel <mmuetzel>
Project Member
Thu 24 Mar 2016 06:48:15 PM UTC, comment #2:

If it does, it appears to be undocumented.

But then again, things like

don't seem to be documented either, and I'm pretty sure that works.

It is, however, documented that you can do

with handles props and vals all being cell arrays. I'm not sure how particular it is about sizes, though it appears to be possible to set different values for a given property for each handle.

Also, I don't know whether calls like

are supposed to work if struct array has the right dimensions for the vector of handles. I would assume so, since this could be converted directly to the

form.

John W. Eaton <jwe>
Project Administrator
Thu 24 Mar 2016 06:25:42 PM UTC, comment #1:

Do you have access to Matlab? Can you test whether mixed struct/pairs are supported?

Rik <rik5>
Project Administrator
Thu 24 Mar 2016 05:58:45 PM UTC, original submission:

When setting properties, they can be passed as structures or as property value pairs. While setting the properties in either the one or the other form works, it fails when both are mixed:

The last line throws the error:

Attached please find a patch fixing this error.

Markus Mützel <mmuetzel>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #36752:  set_struct_pv.patch added by mmuetzel (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by mmuetzel (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 26 Mar 2016 05:08:50 AM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 24 Mar 2016 08:45:56 PM UTCrik5StatusNeed Info=>Confirmed
    Thu 24 Mar 2016 06:31:31 PM UTCjweRelease4.0.1-rc1=>dev
    Thu 24 Mar 2016 06:25:42 PM UTCrik5StatusNone=>Need Info
    Thu 24 Mar 2016 05:58:45 PM UTCmmuetzelAttached File-=>Added set_struct_pv.patch, #36752

    Back to the top


    Powered by Savane 3.1-cleanup1