help-octave
[Top][All Lists]

## Re: find frequencies

 From: Paolo Ariano Subject: Re: find frequencies Date: 09 Dec 2002 14:57:36 +0100

```Il lun, 2002-12-09 alle 13:17, Laurent Jacques ha scritto:
> Is this right ?
>
> octave> a=[1,2,3,0,5,6,0,0,9,0,0,0,13,14,0]
> a =
>
>    1   2   3   0   5   6   0   0   9   0   0   0  13  14   0
>
> octave> pos=find(diff([~a 0])==-1)
> pos =
>
>    4   8  12  15
>
> octave> csum=cumsum(~a)
> csum =
>
>   0  0  0  1  1  1  2  3  3  4  5  6  6  6  7
>
> octave> diff([0 csum(pos)])
> ans =
>
>   1  2  3  1
>
>
> Laurent

it really seems to be what i'm searching for, i'll try it on my matrix.

thanks a lot for your help

paolo
--
Paolo Ariano
Neuroscience PhD Student
DBAU & INFM Turin (Italy)

I bravi ragazzi vanno in Paradiso, i cattivi in Giro --
<Riccardo M.

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```