octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #67048] findobj with 'tag'=[]


From: Rik
Subject: [Octave-bug-tracker] [bug #67048] findobj with 'tag'=[]
Date: Thu, 24 Apr 2025 16:12:50 -0400 (EDT)

Follow-up Comment #5, bug #67048 (group octave):

What does Matlab return for


isequal ('', [])


Octave returns true which we already know.  I also know that, in general,
Matlab will change data types to make matching possible.  They document that


isequal('A',65)
=> 1


Maybe there is an exception for empty matrices, although probably not.

It's more likely that some of the code in findobj.m would need modification.
THere is this block


elseif (numel (p.(pname{np})) == numel (pvalue{np}))
  if (ischar (pvalue{np}) && ischar (p.(pname{np})))
    match(nh,np) = strcmpi (pvalue{np}, p.(pname{np}));
  elseif (isnumeric (pvalue{np}) && isnumeric (p.(pname{np})))
    match(nh,np) = all ((pvalue{np} == p.(pname{np}))(:));
  else
    match(nh,np) = isequal (pvalue{np}, p.(pname{np}));
  endif


Currently Octave checks that both property value (in this case, the value of
the tag field which is '') and the search term value (in this case []) are
character vectors before it will use strcmpi() to compare them.  This could be
modified to check only that the property value is a character vector and then
use strcmpi() which would produce a value of false when compared to [].

In addition to the first Matlab test, could you try the following code


close all
figure (3, 'tag', 'A')
findobj (0, 'tag', 65)


If Matlab is really comparing types without promotion then this should return
no objects.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67048>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]