From: Gerry on 15 Mar 2010 18:54 Hello, I am trying to clean some bad data points from my data set following a couple of conditions: First, the value in column 2 has to be lower that some value; from there, values in the 3rd column will be =NaN until they are lower than some number .... something like this: x=[ 1 4 1; 2 6 0.2; 3 2 0.3; 4 -1 1.5; 5 -0.1 1; 6 0 1.5; 7 2 1; 8 4 0.5; 9 -1 1.5; 10 -1 1]; if x(:,2)<0 (--> rows= 4,5,9,10) then ... values in 3rd column = NaN until values 3rd column are <1 (--> rows= 4,5,6,7,9,10) NOTE that in this example, I actually want to keep row 1, since doesn't comply with the first condition, but clean also rows 6 and 7, because of the second condition. so the result will be: y=[ 1 4 1; 2 6 0.2; 3 2 0.3; 4 -1 NaN; 5 -0.1 NaN; 6 0 NaN; 7 2 NaN; 8 4 0.5; 9 -1 NaN; 10 -1 NaN]; I apologize about the long example, but I am getting desperate here!!! Thanks in advance...
|
Pages: 1 Prev: set size limit for displaying arrays in console Next: 3d From 2d |