help-octave
[Top][All Lists]
Advanced

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

Re: How to extract sequenced data from an array?


From: Ben Abbott
Subject: Re: How to extract sequenced data from an array?
Date: Wed, 22 Dec 2010 07:43:27 -0500

On Dec 22, 2010, at 4:39 AM, new_user wrote:

> Hi,
> having sequenced data array I would like to extract it's unique part.
> 
> Let's consider this simple array:
> 
> X =
> 1 2 
> 1 2
> 2 2
> 3 1
> 2 3
> 1 2 
> 1 2
> 2 2
> 3 1
> 2 3
> 1 2 
> 1 2
> 2 2
> 3 1
> 2 3
> 
> {...}
> 
> I would like to get:
> 
> Y =
> 1 2 
> 1 2
> 2 2
> 3 1
> 2 3
> 
> as a result.
> 
> Thanks for your time

I don't understand what is unique about the result you'd like to get.

It looks to me like Y is identical to X, but truncated to 5 rows, Y = X(1:5,:)

Assuming you'd like to find the unique values for each column of x ...

        cellfun (@unique, mat2cell (X, rows(X), ones(1,columns(X))), 
"uniformoutput", false)

Ben




reply via email to

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