[Top][All Lists]

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

Re: Excluding elements of a matrix

From: Quentin Spencer
Subject: Re: Excluding elements of a matrix
Date: Tue, 19 Dec 2006 12:38:08 -0600
User-agent: Thunderbird (X11/20061107)

Francesco Potorti` wrote:
It's unwieldy, but you can copy your matrix to a new one, remove the
elements you don't want to see, and then display that matrix instead:

    B = A;
    B(6) = [];  #Remove 6th element from B.

Expanding on this suggestion, you can do:

index=1:length(A);            # index of all elements of A
index([6 8 9]) = [];          # remove some of them
plot(A(index));               # access only the interesting elements

Another option is using setdiff from octave-forge:
index = setdiff(1:length(A),[6,8,9]);

This is more concise, but probably a little computationally slower than Francesco's proposal.


reply via email to

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