08-08-2018 11:19 AM
hello,
i have got data in the form of 1-D array but now i want to truncate it from and uptoa certain value say i want the elements from 0 to 2 (elements are also in negative and greater than 2) .
how should i start this or how to do it,i want this data for further analysis.please do respond as i have to submit my project this weekend
Solved! Go to Solution.
08-08-2018 11:38 AM
Wire the array to a For Loop and use a "In range and coerce" function where the "In Range" output gets wired to the condition terminal of an indexing tunnel coming out of the For Loop.
@jyot445...how should i start this or how to do it,i want this data for further analysis.please do respond as i have to submit my project this weekend
Since this sounds like a homework problem I will let you learn about LabVIEW by trying to figure out what I just wrote.
Ben
08-08-2018 01:01 PM
"truncate" implies removing a consecutive range of elements from either end base on index. If I read this right, you want to "filter" based on value (not index).
If you are not clear about terminology, please provide a more explicit example. For example what kind of result would you expect from the following array: [1,2,5,1,9,4,1]?
08-08-2018 01:05 PM
yes,this is what i want to do;filtering.from the array as you have given i want data to be shown above 1 and below 8
08-08-2018 01:13 PM
@jyot445 wrote:
yes,this is what i want to do;filtering.from the array as you have given i want data to be shown above 1 and below 8
We have no idea which post you are replying to and even then, we have no idea what "this" means. Are you talking about "value" or "index" when you say "above 1 and below 8"
08-08-2018 01:15 PM
@jyot445 wrote:
yes,this is what i want to do;filtering.from the array as you have given i want data to be shown above 1 and below 8
Then add a Boolean Not to the output if the "In Range" I mentioned in the solution I posted above.
Ben
08-09-2018 12:20 AM - edited 08-09-2018 12:48 AM
@altenbanch
When I acquire my data I get a 1-D array with anywhere from 10 - 30 data points. There are always some good data points & the rest are of no further use . A good data point is in the range of 0-3(it can be any specified value) & a bad point is below 0 and above 3(numeric value).how can I filter out these bad points? I am with labVIEW 2016 version.
08-09-2018 12:59 AM
Hi iyot,
do as has been suggested several times:
- use InRangeAnCoerce to determine "good" or "bad" samples (are there also ugly ones? :D)
- put a FOR loop around your IR&C function to autoindex all samples from your array
- use a conditional output tunnel to only output the "good" samples…
08-09-2018 11:25 AM - edited 08-09-2018 11:27 AM
@jyot445 wrote:
@altenbanch
When I acquire my data I get a 1-D array with anywhere from 10 - 30 data points. There are always some good data points & the rest are of no further use . A good data point is in the range of 0-3(it can be any specified value) & a bad point is below 0 and above 3(numeric value).how can I filter out these bad points? I am with labVIEW 2016 version.
Yes, we got that by now and you have received exact advice from Ben and Gerd that you seem to ignore(?). Is your LabVIEW version so old that you don't have the conditional tunnel? In that case the solution is very slightly more complicated, but you should be able to figure it out.
Here's what Ben meant long (long!) ago. Note that if the further analysis assumes equal time spacing of the points, this will no longer be true after filtering. (don't do a FFT or graph on a chart!) Also note that the limits can be inclusive or exclusive (look at the diamonds on the icon). Of course even if a value is in the correct range, it could still be bad for some other reason and there is no way to tell.
(Also note that the primitive can be inside or outside the loop, something you might consider testing if the arrays are gigantic. While the primitive could possibly be faster when operating on an array, the additional cost is allocating a boolean array. Only a careful benchmark can tell what's best but it probably really does not matter. OTOH, the compiler might move things around anyway. ;))