octave-maintainers
[Top][All Lists]
Advanced

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

Re: colon equivalence when deleting elements


From: John W. Eaton
Subject: Re: colon equivalence when deleting elements
Date: Fri, 17 Oct 2003 09:03:22 -0500

On 17-Oct-2003, address@hidden <address@hidden> wrote:

| The a(:,:) = [] case is ambiguous and IMHO should be
| disallowed.

I don't see why it is ambiguous.  The indices name all rows and all
columns, so it seems that it should delete everything and return a 0x0
empty matrix.  What are the other possibilities?

| > 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.
| 
| For an N-d array, N-1 of the dimensions must be a colon
| so that the entire slice is removed.  If not then you would get
| surprising results, such as a(i,j) = [] deleting all of row i and
| all of column j.

OK, I see that, but what I am asking is why it should matter if the
index is a colon or scalar or a range or a matrix (elements in any
order) as long as they name all the rows, columns, pages, etc. and are
therefore equivalent to a colon.

jwe



reply via email to

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