[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: element extraction from vector
From: |
Vic Norton |
Subject: |
Re: element extraction from vector |
Date: |
Sat, 26 Dec 2009 20:23:40 -0500 |
v = u(u != 0); w = [1 : length(u)](u !=0)';
On Dec 26, 2009, at 7:20 PM, address@hidden wrote:
> Hi the Octavers,
> I would like to ask you: if we have a vector u of this form:
> u=[1 0 0 0 0 -1 0 0 0 0 0 1]';
> How we can construct a program that extract two vectors v and w from u, where
> the elements of v are 1 and -1, i.e v=[1,-1,1]', and the elements of w are
> the number of observations of the elements of v in u, i.e w=[1 6 12]'.
> Many thanks in advance.
> Hassen.
>
>
> ____________________________________________________
>
> Tables en fĂȘte, recettes parfaites, sorties en goguette tout est sur
> http://evenementiel.voila.fr/Noel
>
>
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave