11-02-2011 10:33 PM
Dear all,
I have tried to manipulate some array but am not successful.
Right now, i have a ref array : 1 2 3 4 5 6 7 8 9 10
and a measured array : 4.2 , 5.2 ,8.2, 9.2.
The measured array will be compared with the ref array and if the measured array falls within the range ref array, the value in the measured array will be recorded else it will be filled with zeros.
Finally the answer should be something like: 0, 0, 0, 4.2, 5.2, 0, 0, 8.2, 9.2, 0.
I have managed to get to the 1st iteration and return the result as : 0 ,0 ,0, 4.2, 0, 0, 0, 0, 0, 0 but unable to proceed further.
What must i do to get the desried results? I have attached a sample VI.
Can anyone help me on this? One thing is that both measured and ref array will always be in ascending order, how do i code them to run more efficiently?
Thank you!
Solved! Go to Solution.
11-02-2011 11:32 PM
Dear all,
I have managed to get the answer after some coding. May i know is there a better way to code it more efficiently? Attached is the code.
The data that i am dealing with is a few thousand values and i am wondering if this code is efficient. How to make it more effiicient?
Thank you!
11-03-2011 12:04 AM
Is the ref array a plain [1,2,3..N] array. In this case you would not even need it, right?
Try this...
Also:
What should happen if there are multiple values for the same bin?
You probably need to size the output array for wider data.
11-03-2011 12:31 AM
HI Joven,
check the attached VI snippet.
Regards,
GK
11-03-2011 01:11 AM
Nope it is not plain number 1,2 .... It is some number with decimal places.
Any changes need to make in the VI?
11-03-2011 01:36 AM
@Joven wrote:
Nope it is not plain number 1,2 .... It is some number with decimal places.
So why is it I32 then???
What is the significance of your +/-0.3. You really need to define the problem better. If the ref array is not integer, then make an example with more typical data.
Here's a quick draft using the reference array. Probably needs some tweaks, but should get you started.
11-03-2011 03:44 AM
Dear Alten,
Yah thanks for the help. The range is necessary to find the measured value that falls between the ref range of +/-3. I manage to make some changes and tweaks and come out with the desired result. It is much shorter using replace array subset function. Thank you for your and everyone help!