help-octave
[Top][All Lists]
Advanced

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

Re: Newbie - Common value patterns in many vectors


From: Fernando
Subject: Re: Newbie - Common value patterns in many vectors
Date: Wed, 5 Oct 2011 07:48:47 -0700 (PDT)

Hi

Use the ismember function

Possible solution will look something like this:

[r,c] = size(matrix) ;
k = 1:r;
for i=1:r
        # remove the zeros 
        rowvec = matrix(i,:)(matrix(i,:) > 0);
        
        for ii=k(k != i) # To ensure not to compare the same vectors
                X = matrix(ii,:)(matrix(ii,:) > 0 );
                # a takes 0 or 1
                [a,b]=ismember( rowvec , X );
   end  
end

assuming you constructed a matrix from your vectors and padding it with
zeros for equal column dimension.
Havnt tested it yet, but should point in the right direction.

Cheers 
Fernando



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Newbie-Common-value-patterns-in-many-vectors-tp3874114p3874744.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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