10-17-2016 11:13 AM - edited 10-17-2016 11:20 AM
Given "y" as an N-element array of doubles randomized using a normal distribution, the following is true.
In MatLab (R2014a) you can do this:
is_gt_zero = (y>0)
y_subset = y[is_gt_zero]
and get an array comprised of the positive elements of "y".
In "R" you can do this:
is_gt_zero <- which(y>0, arr.ind=F)
y_subset <- y(is_gt_zero)
and get the same.
LabView has the "In Range and Coerce" vi. It gives a boolean array, but I am not finding boolean indexing. I really don't like nesting for loops. Is there a way to not do that?
Do I need to wrap a for loop around the boolean array and look for true indices, or is there a cleaner way to do boolean-driven indexing?
10-17-2016 11:18 AM
Try something like this.
10-17-2016 11:19 AM - edited 10-17-2016 11:19 AM
A simple FOR loop with conditional autoindexing tunnel should do the trick for you.