help-octave
[Top][All Lists]
Advanced

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

Re: How to leave out selected elements from a vector?


From: Francesco Potorti`
Subject: Re: How to leave out selected elements from a vector?
Date: Thu, 17 Jul 2008 12:50:30 +0200

>> Here is my question. In Mathematica, there exists a function called
>> Drop, which I often use to manipulate lists, e.g., Drop[ list, {m, n}
>> ] returns the argument list with the elements m through n omitted from
>> the list (the resultant list is shorter for (n - m + 1) elements).
>>
>> Does anything similar already exist in Octave? I know I can program it
>> myself, but I wouldn't want to reinvent the wheel. :)
>
>Use indexing. For instance [list(1:m-1), list(n+1:end)] could do what
>you want.

Assuming, as Michael did, that you want to remove elements from an
array, you can alternatively do
  list(m:n)=[];

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

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