[Top][All Lists]

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

Re: adding an op

From: John W. Eaton
Subject: Re: adding an op
Date: Wed, 1 Jun 2005 14:29:00 -0400

On  1-Jun-2005, Tom Holroyd wrote:

[Some background:  Tom asked about extending Octave to handle CELL ==
CELL operations.  Apparently, this is not allowed by Matlab, but it
might be useful.  --jwe]

| When I saw that error, though, I just assumed that matlab could do
| it.  It seems obvious.  The current implementation of setdiff would
| "just work" if == could do cells, though.

I think we might also want to support other logical tests.  What would
the return value be for CELL OP CELL where OP is one of <, <=, ==, >=,
>, or != (I'm assuming that it would work element-by-element in all

It seems to me that it should be a cell array of values, and that the
values would be the result of the element-by-element operations.  Then
an expression like

  {[1,2,3], 1, "xyz"} == {[3,2,1], 2, "zyx"}

would produce

  {[0,1,0], 0, [0,1,0]}

(with all elements having a logical type).

Does that seem reasonable?  Attempting to compare structures would
fail until someone implements the corresponding operators for
structures, which I suppose could be handled in a similar
element-by-element fashion.  Would this really be useful?


reply via email to

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