subdelete

The subdelete operator deletes data from an array according to coordinates specified by one or more secondary arrays, called pick arrays.

Synopsis

subdelete ( ARRAY_NAME, PICK_0 [ , PICK_n ]* )

Summary

The subdelete operator deletes cells from an array based on coordinates selected by the pick array inputs. The pick arrays are processed with the same algorithm used by subarray, but instead of returning the selected cells as subarray does, subdelete deletes them. Refer to the subarray documentation for a detailed discussion of pick arrays and the grid, cell-wise, and hybrid selection modes.

Examples

Start with a small 3x3 cube of values:

AFL% create array m3x3<v:int64>[i=0:2; j=0:2; k=0:2]; Query was executed successfully AFL% store(build(m3x3, i*100 + j*10 + k), m3x3); Query was executed successfully AFL% scan(m3x3); {i,j,k} v {0,0,0} 0 {0,0,1} 1 {0,0,2} 2 {0,1,0} 10 {0,1,1} 11 {0,1,2} 12 {0,2,0} 20 {0,2,1} 21 {0,2,2} 22 {1,0,0} 100 {1,0,1} 101 {1,0,2} 102 {1,1,0} 110 {1,1,1} 111 {1,1,2} 112 {1,2,0} 120 {1,2,1} 121 {1,2,2} 122 {2,0,0} 200 {2,0,1} 201 {2,0,2} 202 {2,1,0} 210 {2,1,1} 211 {2,1,2} 212 {2,2,0} 220 {2,2,1} 221 {2,2,2} 222 AFL%

Use grid selection to delete all cells with (i, j) values in the cross product of {1} x {0, 2}:

AFL% subdelete(m3x3, CON> build(<i:int64>, from:'[[1]]'), CON> build(<j:int64>, from:'[[0, 2]]')); Query was executed successfully AFL% scan(m3x3); {i,j,k} v {0,0,0} 0 {0,0,1} 1 {0,0,2} 2 {0,1,0} 10 {0,1,1} 11 {0,1,2} 12 {0,2,0} 20 {0,2,1} 21 {0,2,2} 22 {1,1,0} 110 {1,1,1} 111 {1,1,2} 112 {2,0,0} 200 {2,0,1} 201 {2,0,2} 202 {2,1,0} 210 {2,1,1} 211 {2,1,2} 212 {2,2,0} 220 {2,2,1} 221 {2,2,2} 222 AFL%

Use cell-wise selection to delete the particular cells at {2,2,1} and {1,1,2}:

AFL% subdelete(m3x3, CON> build(<i:int64, j:int64, k:int64>, CON> from:'[[(2, 2, 1), (1, 1, 2)]]')); Query was executed successfully AFL% scan(m3x3); {i,j,k} v {0,0,0} 0 {0,0,1} 1 {0,0,2} 2 {0,1,0} 10 {0,1,1} 11 {0,1,2} 12 {0,2,0} 20 {0,2,1} 21 {0,2,2} 22 {1,1,0} 110 {1,1,1} 111 {2,0,0} 200 {2,0,1} 201 {2,0,2} 202 {2,1,0} 210 {2,1,1} 211 {2,1,2} 212 {2,2,0} 220 {2,2,2} 222 AFL%