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

 
 

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

Submitter:  None
Submitted:  Thu 10 Oct 2019 02:36:34 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Martin Veenstra Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.1.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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)
  •  

    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 group 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.13-758e.
    Corresponding source code