bugGNU Octave - Bugs: bug #57030, findobj does not work with a cell...

 
 

bug #57030: findobj does not work with a cell array property value

Submitted by:  None
Submitted on:  Thu 10 Oct 2019 02:36:34 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error
Status:  Fixed Assigned to:  None
Originator Name:  Martin Veenstra Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  5.1.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.

 

Thu 10 Oct 2019 04:19:12 PM UTC, comment #1: 

Thanks for catching the typo.  I fixed the problem in this changeset https://hg.savannah.gnu.org/hgweb/octave/rev/d4ee26280bb9.  This will be a part of the next bug fix release of Octave, or you can download the m-file from the Octave Mercurial repository if you need the fix sooner.

I kept lines 252-253 for performance.  Unlike in Matlab, the Octave isequal function is not a built-in (i.e., a compiled function) so it is relatively slow.  Therefore, if both arguments are numeric it is better to use the compiled '==' operator for comparison.

Rik <rik5>
Project Administrator
Thu 10 Oct 2019 02:36:34 PM UTC, original submission:  

>> findobj('UserData',{1,2,3})
error: invalid conversion from cell array to logical value
error: called from
    findobj at line 252 column 15

One parenthesis is wrongly placed on this line.
wrong:

              elseif (isnumeric (pvalue{np} && isnumeric (p.(pname{np}))))

correct:

              elseif (isnumeric (pvalue{np}) && isnumeric (p.(pname{np})))

The function works with this correction for cell array property value. However, it doesn't work anymore with empty numeric array property value.

>> findobj('UserData',[])
error: findobj: =: nonconformant arguments (op1 is 1x1, op2 is 0x0)
error: called from
    findobj at line 253 column 30

Lines 252 and 253 are superflue.
wrong:

              elseif (isnumeric (pvalue{np}) && isnumeric (p.(pname{np})))
                match(nh,np) = (pvalue{np} == p.(pname{np}));

correct:

              ##elseif (isnumeric (pvalue{np}) && isnumeric (p.(pname{np})))
              ##  match(nh,np) = (pvalue{np} == p.(pname{np}));

The function works with this correction for property values that are empty/scalar/vector/matrix numeric arrays and cell arrays.

Anonymous

 

(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 None (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-10 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5