help-octave
[Top][All Lists]
Advanced

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

Re: lookback function? or instlookback?


From: abl5
Subject: Re: lookback function? or instlookback?
Date: Fri, 2 Dec 2005 07:07:14 -0500 (EST)

On Thu, 1 Dec 2005, Francesco Potorti` wrote:

> >-Take two specific vectors of data, say I and J
> >-Start two counters at the first element. One increments by one every row
> >(until reset) and the other increments by 1 when either
> >     --there is a non-zero difference between the current non-zero
> >value of I and the most recent previous non-zero value of I
> >     or
> >     --the same is true for J
> >The other challenge is that both I and J change their non-zero values at
> >the same time, but because only I or J is non-zero in a given row, I also
> >have to figure out how to tell the counters to reset & increment for the
> >first of those two changes but not for the second.
>
> It seems to me that the two statements
> - both I and J change their non-zero values at the same time
> - only I or J is non-zero in a given row
> are contradictory, so I don't understand what you want to do.

Ok. Here is a sample matrix:
I       J
0       20
0       20
40      0
0       20
40      0   <<between this row and the next, values are changed for I & J
20      0
0       40
etc...

>
> Anyway, if I have understood anything, this kind of things can be done
> using combinations of the functions cumsum, diff and find, possibly with
> the help of prepad and postpad.

ok, thanks.

Arwen
>
> --
> Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
> ISTI - Area della ricerca CNR          Fax:   +39 050 313 8091
> via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
> Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key
>



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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