10-02-2013 12:14 PM
I have an input array that I am looking to manipulate.
We are measuring a torque device. In the measurement sequence we want to display the data on a continuously rising slope, though when we let off the acceleration of our moving device at the end of the test we end up with higher torque #s at the beginning of the RPM sequence ... which blurs our slope line on our graph.
For example, see the attached PNG on the torque/rpm array. I need to be able to cut out the first 2 rows of the array as we need to go from least to greatest in the torque row sequence. Throughout the test we may have a torque number in row 10 for example that is greater than the torque value in row 11, thus we would need to cut out the torque value in row 10.
I've attached the sub vi that I've wired in order to attempt this, but cannot get it to work. I am not looking to sort the array, but to remove the rows that are greater than the rows after them ... with respect to the RPM value consistently decreasing. If I have a pair value of 2340/1869 in row 1 & 276/1839 in row 2, I need row 1 removed. But if I have a pair value of 2509/1704 in row 12 & a pair value of 2493/1689 in row 13, I'd want to leave that torque value in (if possible) as it is a realistic aspect of the torque curve captured throughout the power sweep of the test.
Any ideas?
Solved! Go to Solution.
10-02-2013 01:27 PM - edited 10-02-2013 01:29 PM
It likely won't get you all the way there, but you could use Array Subset with your Array Max & Min to have your array start at the min value. It will get you there with the specific data you have given.
I used the Min Index to tell the subarray where to start and left the length unwired so it would default to the rest of the array.
10-02-2013 01:47 PM
Basically, loop through all rows and compare them to the _previous_ and if it's at most 5% bigger (e.g.) add it to a resulting array, else skip it.
The result should be a cleaned array.
/Y
10-02-2013 01:58 PM - edited 10-02-2013 02:01 PM
Since it seems we are looking for the linear portion of the plot, could we not treat it similarly to a gain plot and compare the ratio of x to y and when it reaches a point where it starts moving away from 1:1 (your call where exactly that is), that's where our cutoff point is?
[edit]
well, that's not exactly right, but you get the picture
[/edit]
10-02-2013 02:13 PM
here..
10-02-2013 03:24 PM
could you post this code in LV 2011.... thank you for the help.
10-02-2013 05:25 PM - edited 10-02-2013 05:31 PM
ready!
10-03-2013 04:05 PM
thank you for the VI. This will do the job