[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Excluding elements of a matrix (Joseph Wakeling)
From: |
Joseph Wakeling |
Subject: |
Re: Excluding elements of a matrix (Joseph Wakeling) |
Date: |
Mon, 25 Dec 2006 20:31:41 +0100 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20061115) |
Alexander Barth wrote:
> An alternative way, is to do
>
> octave:2> A = magic(4)
> A =
>
> 16 2 3 13
> 5 11 10 8
> 9 7 6 12
> 4 14 15 1
>
> octave:3> A(1:end ~= 2,:)
> ans =
>
> 16 2 3 13
> 9 7 6 12
> 4 14 15 1
That's a nice way. Is there a comparable way of subtracting _several_
elements? Your method works in 2.1.73 but trying e.g. A(1:end~=[2 3],:)
doesn't (for obvious reasons since you can't compare a number to a
vector for equality...).
Season's greetings to all. :-)