Deleting rows in a matrix [message #89178] |
Wed, 30 July 2014 18:19  |
sylvestergreene51
Messages: 3 Registered: July 2014
|
Junior Member |
|
|
Hello, I would like to delete a row from a 3D matrix. In the 2 column there is a 4 that I don't want thus I need to delete the entire row. I tried using code from the coyote website https://www.idlcoyote.com/idl_way/remove_rows.php but I think my IDL is too old ( I have version 6.7) as it wont allow me to use /NULL with the WHERE function. Any suggestions?
25.000000 90.000000 28.000000
26.000000 92.000000 29.000000
27.000000 95.000000 30.000000
29.000000 97.000000 31.000000
31.000000 99.000000 33.000000
32.000000 101.00000 35.000000
33.000000 104.00000 37.000000
34.000000 107.00000 0.0000000
35.000000 4.0000000 0.0000000
36.000000 117.00000 40.000000
38.000000 119.00000 42.000000
39.000000 121.00000 43.000000
40.000000 124.00000 44.000000
42.000000 127.00000 45.000000
43.000000 129.00000 46.000000
45.000000 131.00000 48.000000
46.000000 133.00000 49.000000
|
|
|
Re: Deleting rows in a matrix [message #89179 is a reply to message #89178] |
Wed, 30 July 2014 23:16  |
Moritz Fischer
Messages: 32 Registered: June 2013
|
Member |
|
|
How about using the COUNT keyword to the where function?
i.e. replacing the line
shortArray = array[*, Where(~Histogram( ...
by the lines
tmp = Where(~Histogram(rows, MIN=0, MAX=dims[1]-1), COUNT = count)
IF count NE 0 THEN shortArray = array[*, tmp]
Am 31.07.2014 03:19, schrieb sylvestergreene51@gmail.com:
> Hello, I would like to delete a row from a 3D matrix. In the 2
> column there is a 4 that I don't want thus I need to delete the
> entire row. I tried using code from the coyote website
> https://www.idlcoyote.com/idl_way/remove_rows.php but I think my IDL
> is too old ( I have version 6.7) as it wont allow me to use /NULL
> with the WHERE function. Any suggestions?
>
>
> 25.000000 90.000000 28.000000 26.000000 92.000000
> 29.000000 27.000000 95.000000 30.000000 29.000000
> 97.000000 31.000000 31.000000 99.000000 33.000000
> 32.000000 101.00000 35.000000 33.000000 104.00000
> 37.000000 34.000000 107.00000 0.0000000 35.000000
> 4.0000000 0.0000000 36.000000 117.00000 40.000000
> 38.000000 119.00000 42.000000 39.000000 121.00000
> 43.000000 40.000000 124.00000 44.000000 42.000000
> 127.00000 45.000000 43.000000 129.00000 46.000000
> 45.000000 131.00000 48.000000 46.000000 133.00000
> 49.000000
>
|
|
|