help-octave
[Top][All Lists]
Advanced

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

Re: using find function to wrap set functions


From: Martin Helm
Subject: Re: using find function to wrap set functions
Date: Wed, 26 Oct 2011 15:48:21 +0200

Am Mittwoch, den 26.10.2011, 06:21 -0700 schrieb thombark: 
> I would like to use "find" with some set functions, because a for loop takes
> too much time. For example, I have a large array  aa (100000,10) where each
> row has 10 numbers. I want to use the complement function to find all rows
> that contain the values [12 54 77]. This code is too slow:
> 
> for ix = 1:rows(aa)
>       if (columns(complement (aa(ix,:), [12 54 77])) == 0)
>       ...save ix...
>       endif
> endfor  
> 
> I would like to wrap this in a find function, but I don't know the syntax
> for this.
> 
> find(columns(complement (aa(:,:), [8 43])) == 0); does not work.
> 

This solution is probably completely stupid, but what about 

find(sum(aa==12 | aa==54 | aa==77, 2) == 3)





reply via email to

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