04-03-2020 08:19 AM
Hello all,
I was hoping if anyone can help me with a small algorithm.
I have an array of numeric data as an input and based on a condition i output the indices of the array which pass the condition i.e array of indices as an output.
Now i want to apply another filter on the filtered data, i have been scratching my head on this trivial problem, any help will be much appreciated!
Attached is the test vi with single filter.
04-03-2020 09:31 AM
Just chain up the filters. 🙂 You can filter the data at the same time as you check the index.
04-03-2020 09:56 AM
Thanks for the reply! I think i didn't make it clear enough, i was thinking in the direction of having "filter parameters in an array" and looping over all the "filter parameters" (on different columns) and in the end output filtered indices of the original array.
04-06-2020 02:39 AM
This is textbook OO polymorphism (composite pattern).
+ Make a filter class.
+ Inherit filters from it.
+ Give each child it's own init that set's it's parameters.
+ Make a composite child that executes an array of filters (the init takes an array).
The code using the filter won't know (and doesn't have to know) if it's a single filter or a composite (if you don't want it to).