[scilab-Users] Re: reducing timeseries dataset for later on linear interpolation

Samuel Gougeon sgougeon at free.fr
Fri Jun 1 10:19:27 CEST 2012


Hello David,

Le 31/05/2012 09:24, David Chèze a écrit :
> Hi,
>
> I've done it that way:
>
> dat=[0 0 1 3 2 2 0 0 0 0 2 4 2 4 4 2 0 0 0 0];
> plot2d(dat)
> datp=diff(dat);
> datp_1=[datp(1) datp(1:$-1)];
> k=find(datp<>datp_1)
> datr=dat(k);
> plot2d(k,datr)
>
> i should have add the first point of dat in datr to have exactly the same
> curve but it works.
> Is there a more direct and efficient way to do that in Scilab?
>    
Here is another way:

dat($+1) = %nan;
i = find(dat(2:$)~=dat(1:$-1));
plot2d(dat(unique([i-1 i])))

Regards
Samuel



More information about the users mailing list