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

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

[Octave-bug-tracker] [bug #49364] odeset does not implement non-exact ma


From: Rik
Subject: [Octave-bug-tracker] [bug #49364] odeset does not implement non-exact match to property name.
Date: Thu, 20 Oct 2016 15:18:37 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #5, bug #49364 (project octave):

@Carlo: I tried "isempty (odestruct_extra)" the first time I recoded the
routine, but discovered a quirk.  isempty() returns true if the number of
elements is 0.  Thus a scalar structure is a 1x1 object and has one element,
even if it has no field names.  This is not what most people mean when they
say "the structure is empty".  See the following code in Octave which is
unintuitive.


octave:1> x = struct ()
x =

  scalar structure containing the fields:


octave:2> size (x)
ans =

   1   1

octave:3> isempty (x)
ans = 0
octave:4> y = struct ([])
y =

  0x0 struct array containing the fields:


octave:5> size (y)
ans =

   0   0

octave:6> isempty (y)
ans = 1


However, if you use fieldnames then both "empty" structures above report that
they are empty.  Searching around on the Internet I found that the fieldnames
method is, indeed, the recommended way to test structures for being empty.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49364>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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