[Top][All Lists]

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

Re: Excluding elements of a matrix

From: Joseph Wakeling
Subject: Re: Excluding elements of a matrix
Date: Tue, 19 Dec 2006 18:08:27 +0100
User-agent: Thunderbird (X11/20061115)

Bill Denney wrote:
> You can do something like
> a = 1:10;
> b = a([1:5 7:10])

Sure; this is selectively _including_ elements of a vector/matrix (in
this case, elements 1-5 and 7-10).  I was wondering if there's a
comparably simple notation for _excluding_ elements.

The reason I ask is that, for example, if I want to remove element k
from a given vector, there are special cases.  I can't just write,

a = a([1:(k-1) (k+1):columns(a)])

because obviously I might have k=1 or k=columns(a).

It would simplify things a lot if instead of having to write extra lines
to take into account these special cases, there were a notation giving
"everything but element k".

reply via email to

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