Showing a selected subset of rows of a 2D wave within a Listbox

Hi all,

I'm fairly new to Igor but have considerable experience in conventional procedural languages.

i am using a ListBox to display a 2D text wave, and am now trying to apply a "filter" (on the 2D text wave), so that I would show only those rows where a text match is found within a given column. If there is no better way, I could use a separate filtered copy of the wave and display that. I have tried EXTRACT (StringMatch in the LogicalExpression), which works nicely on 1D waves, but apparently finds all matches regardless of their column in the 2D source wave. Can EXTRACT be restricted to a specific column?

I have also tried using the /INDX flag, and here I learned that EXTRACT treats the 2D wave as a concatenated 1D wave, with consecutive indexes. I can imagine developing some messy arithmetic to deduce what column and row a match was found within, but I suspect there may be a better approach to do what I am trying to do. Assuming I know which matched rows to display, what's the best approach to show only the selected rows? Is there something more appropriate than Extract?

Thanks for any suggestions.

doctordan wrote:

i am using a ListBox to display a 2D text wave, and am now trying to apply a "filter" (on the 2D text wave), so that I would show only those rows where a text match is found within a given column. If there is no better way, I could use a separate filtered copy of the wave and display that. I have tried EXTRACT (StringMatch in the LogicalExpression), which works nicely on 1D waves, but apparently finds all matches regardless of their column in the 2D source wave. Can EXTRACT be restricted to a specific column?


To limit the results to a particular column, for your logical expression, use q==colNum && <the rest of the expression> where colNum is the column number you want to limit the results to.

To use the /INDX flag, you might want to limit the results of the extract operation to indices in column 0. For example:
Make/N=20 ddd = p
Redimension/N=(5,4) ddd
Extract/INDX ddd, ddd_ext, (q==0 && mod(ddd[p][3], 2) == 0)
print ddd_ext
  ddd_ext[0]= {1,3}


In other words, the values of rows 1 and 3 in column 3 are even numbers.