help-octave
[Top][All Lists]
Advanced

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

Re: Extracting matrix rows that meet a condition


From: Ismael Diego Nunez-Riboni
Subject: Re: Extracting matrix rows that meet a condition
Date: Thu, 24 May 2012 17:24:05 +0200

-------- Original-Nachricht --------
> Datum: Thu, 24 May 2012 16:15:14 +0200
> Von: Knof <address@hidden>
> An: Ismael Diego Nunez-Riboni <address@hidden>
> Betreff: Re: Extracting matrix rows that meet a condition

> > I guess the reason is this: In many of your 3-element rows there are
> more than one value meeting your condition. Example:
> >
> > ...
> > 0.1 0.2 6
> > 0.1 7 8
> > ...
> >
> > In the first row you get two values meeting your condition and the
> function "find" gives two entries with the same index i...
> >
> > Try this after using find to eliminate the repeated i-entries:
> >
> > i = unique(i);
>
> Yes rows have multiple values that meet the condition. But that did not
> mess with finding the rows with values that meet the first condition.
> Using the unique tag didn't solve the problem as the results still ends up
> being a to large number pool.
> I am attaching my script file and my matrix so you can see the problem for
> yourself if you want to.
>
>

It works in my case, I get 1005 out of 1008 elements, i.e., apparently almost 
all rows have one element meeting the condition x > 0 & x < 1... I see no 
contradiction... Here it is how I see it (using of course the matrix you 
attached):

[i,j] = find(x < 0 | x > 1);

octave:41> size(x)
ans =

   1008      3

octave:42> size(i)
ans =

   426     1

octave:43> size(j)
ans =

   426     1


octave:45> [k,l] = find(x > 0 & x < 1);

octave:46> size(k)
ans =

   2592      1  % Repeated indices pointing to same row

octave:48> size(unique(k))
ans =

   1005      1  % Unique number of indices < total row no. of x

I fail to see the problem... Almost every single row in x have a value meeting
x > 0 & x < 1...
-- 
Ismael Núñez-Riboni
Hamburg
Deutschland

--------
¿Quién dijo que todo está perdido? 
Yo vengo a ofrecer mi corazón...
Fito Páez

Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


reply via email to

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