help-octave
[Top][All Lists]

## Re: lookback function? or instlookback?

 From: Francesco Potorti` Subject: Re: lookback function? or instlookback? Date: Fri, 02 Dec 2005 13:32:54 +0100

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

I see that, between that row and the next, column I changes its value,
while column J keeps it the same (0).  It would be helpful if you wrote
a (possibly longer) example with four columns: I, J, first counter,
second counter.  Also, supposing there is a function that takes I and J
as arguments, what is the result you want returned by this function.

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