[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extracting matrix rows that meet a condition
From: |
Knof |
Subject: |
Re: Extracting matrix rows that meet a condition |
Date: |
Thu, 24 May 2012 08:36:13 -0700 (PDT) |
> 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...
The problem is I want to spit the matrix into two files. One file where all the rows that contain at least one value that meets the condition
(x < 0 | x > 1) are written to and the other file where all the rows where all three values match the condition (x > 0 & x < 1) are saved to it.
So the second file must contain all the rows that the first file does not.
I am sorry if I have not made that more clear before.
Knof
View this message in context: Re: Extracting matrix rows that meet a condition
Sent from the Octave - General mailing list archive at Nabble.com.
- Extracting matrix rows that meet a condition, Knof, 2012/05/23
- Re: Extracting matrix rows that meet a condition, Ismael Núñez-Riboni, 2012/05/23
- Message not available
- Message not available
- Message not available
- Re: Extracting matrix rows that meet a condition, Ismael Diego Nunez-Riboni, 2012/05/24
- Message not available
- Re: Extracting matrix rows that meet a condition, Ismael Diego Nunez-Riboni, 2012/05/24
- Re: Extracting matrix rows that meet a condition,
Knof <=
- Re: Extracting matrix rows that meet a condition, Ismael Diego Nunez-Riboni, 2012/05/24
- Re: Extracting matrix rows that meet a condition, Knof, 2012/05/24
- Re: Extracting matrix rows that meet a condition, Ismael Núñez-Riboni, 2012/05/24
Re: Extracting matrix rows that meet a condition, Juan Pablo Carbajal, 2012/05/23