[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## colon equivalence when deleting elements

**From**: |
John W. Eaton |

**Subject**: |
colon equivalence when deleting elements |

**Date**: |
Mon, 13 Oct 2003 11:00:15 -0500 |

There is a current thread in comp.soft-sys.matlab about the subtleties
of indexing when deleting elements of a matrix. For example, in
Matlab,
a = 1; a(:,:) = []
results in a 0x1 empty matrix. This doesn't make much sense to me,
but apparently it is working one dimension at a time or something.
Also, the following
a = 1; a(1,1) = []
is not allowed ("Indexed empty matrix assignment is not allowed).
Apparently at least one of the indices must be a colon.
Octave currently checks to see if the index is equivalent to a colon
operator (i.e., it enumerates all possible indices) and if so, works
the same as if a colon had been used.
Should Octave be changed to be exactly compatible for these cases?
jwe

**colon equivalence when deleting elements**,
*John W. Eaton* **<=**