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

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

[Octave-bug-tracker] [bug #61473] unexpected results from eq


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #61473] unexpected results from eq
Date: Sun, 14 Nov 2021 06:40:24 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53

Follow-up Comment #3, bug #61473 (project octave):

Sent via private email:
> I am assuming eq and isequal is an cell element by element comparison within
cellfun.  The code I provided is a comparison of one number with another
number at at a time for each cell element.  Comment #1 is invalid. 
>
> eq gave the wrong result. 

Please use savannah's web interface when answering so others can follow as
well.

You are right, the reason given why the result is different is not complete.

The more complete explanation is that `eq([], 0)` results in `[]` but
`isequal([], 0)` results in `false`. When calling `cell2mat` on the cell array
that contains `[]` in some of its elements, the resulting matrix will have
less elements than the input cell array.

For your case, where the input cell array might contain empty elements, you'll
probably want to use `isequal` (not `eq`).


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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