[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: uniq like function?
From: |
Sergei Steshenko |
Subject: |
Re: uniq like function? |
Date: |
Fri, 16 Apr 2010 08:41:53 -0700 (PDT) |
--- On Fri, 4/16/10, David Bateman <address@hidden> wrote:
> From: David Bateman <address@hidden>
> Subject: Re: uniq like function?
> To: "Evan" <address@hidden>
> Cc: "Octave_post" <address@hidden>
> Date: Friday, April 16, 2010, 12:14 AM
> Evan wrote:
> > I know there is a function of "unique" which returns
> unique elements.
> > I occasionally need a function like the "uniq" command
> under bash
> > which only omit adjacent repeated elements. For
> example, uniq ([1, 2,
> > 2, 3, 2, 2]) returns [1, 2, 3, 2]. Is there already
> such a function in
> > octave? Thanks in advance.
> > _______________________________________________
> > Help-octave mailing list
> > address@hidden
> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >
> >
> octave:7> x = [1,2,2,3,2,2]
> x =
>
> 1 2 2 3 2 2
>
> octave:8> x(x(1:end-1)==x(2:end))=[]
> x =
>
> 1 2 3 2
>
I first asked myself a question about 'end' in the above, and decided to
find an answer using 'help end' in 'octave-3.0.5', so here its output:
"
help end
*** end:
-- Keyword: end
Mark the end of any `for', `if', `do', `while', or `function'
block.
See also: for, if, do, while, function.
Additional help for built-in functions and operators is
available in the on-line version of the manual. Use the command
`doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
at http://www.octave.org and via the address@hidden
mailing list.
".
So to which of "for', `if', `do', `while', or `function'" 'end' here
belongs ?
Thanks,
Sergei.
- uniq like function?, Evan, 2010/04/16
- Re: uniq like function?, David Bateman, 2010/04/16
- Re: uniq like function?,
Sergei Steshenko <=
- Re: uniq like function?, Judd Storrs, 2010/04/16
- Re: uniq like function?, Sergei Steshenko, 2010/04/16
- Re: uniq like function?, Evan, 2010/04/17
- Re: uniq like function?, Judd Storrs, 2010/04/17
- Re: uniq like function?, Evan, 2010/04/17
Re: uniq like function?, Olaf Till, 2010/04/16