03-26-2013 03:21 PM
Hello,
In my attached array, I wanted to generate another array that just contains the numeric LO Freq enteries.
This is my original array:
Temp:RM LO Freq: 136
Temp:RM LO Freq: 136
Temp:RM LO Freq: 136
Temp:RM LO Freq: 136
Temp:RM LO Freq: 136
Temp:RM LO Freq: 136
Temp:RM LO Freq: 155
Temp:RM LO Freq: 155
Temp:RM LO Freq: 155
Temp:RM LO Freq: 155
Temp:RM LO Freq: 155
Temp:RM LO Freq: 155
Temp:RM LO Freq: 155
I wanted to generate the array:
136
155
I was already able to extract the LO Freq numeric values, but need some help to generate the final array together with the array position entry where the LO Freq changes value (in the above case entry 6)
Thanks,
hiNi.
03-26-2013 03:35 PM
Do you only want to add to the array when the value changes? OR do you want to only add a value if it wasn't already in the array.
136
155
136
If you only want to add when changed, use a for loop to check the current value from your string array with the last value added to your output array. If it's different, use "insert into array.vi"
If you want to avoid duplicates (avoiding the example above) you can use "Search 1D array" to determine if the value has ever been entered in the array.
03-26-2013 04:24 PM
Hello,
I am able to generate the frequency array, but I am having a little trouble implementing the search array to remove the duplicate enteries. Also, how do I return the array with the position of the frequency change?
03-26-2013 04:32 PM
I have an older version of labview so I'll try to help with words.
"I am able to generate the frequency array"
Which array? the one which contains all the values from the string array or the final array you were trying to get?
Using a for loop to iterate through the full array, compare the current value with the previous one (a shift register can be used to hold the value from the previous iteration). If it's new, use "insert into array.vi".
The current step of the for loop is the position at which the change occured. i
You can place these values into their own array if you want.
03-26-2013 04:43 PM
Something crude like this could work.
I'm sure there is a more elaborate way to do this somewhere.