LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extracting info from an array

Hello All,

 

I have  amplitude values from a SpecAn, thats been put into an array, how would i go about extracting a range of values then place them into another array, but i would still like to keep its orignal index number. As i would want to manipulate that later on, could that be put into the second array also. If so how would i go about doing that.

 

Any feedback is welcomed

0 Kudos
Message 1 of 17
(3,849 Views)

Hi Thomas,

 

check.png

You pick your needed range of data, then you create an array with the size of your original array (but with all elements set to zero) and replace the needed data in that array...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(3,839 Views)

Hello GerdW,

 

since then i have managed to get both amplitude and frequency into one array what i would like to do now is compare each element and see if they fit in a band if so place into another array, please could you share any ideas as to how to tackle this N.B using 8.6.

 

 

 

0 Kudos
Message 3 of 17
(3,824 Views)

Hi Thomas,

 

in the comparison functions palette you will find the function "In range and coerce". This might help you a lot...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 17
(3,822 Views)

Hello Gerd,

 

Thanks for that still have problems with that, because am only expecting 4 element to be passed, i find out what am doing wrong

 

Thanks

 

Thomas

0 Kudos
Message 5 of 17
(3,818 Views)

Hi Thomas,

 

attach your VI to get more help...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 17
(3,815 Views)

am trying to create a band pass with amplitude values between 0 and -38 then the values that fall into that range into another array with its frequency also.

 

Kind Regards

 

Thomas

0 Kudos
Message 7 of 17
(3,806 Views)

Ugh, too many code optimizations to be had...

 

What's up with the 10 ms wait?  Why do you have the "0" constant wired as an output of the bottom for loop?  Why not autoindex the top for loop, make your frequency calculations based on the size of the array and not some hard-coded number?

 

In fact, the bottom for loop need not exist.  Feed the entire array into the in range/coerce and use the resulting array of "In Range?" booleans to cut out the chunk from your array of freq/data?  (And make sure you actually want the -38 NOT to be included.)

 

Actually, I guess all of the above can be done all at once if you're sneaky.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 17
(3,780 Views)

Hello Bill,

 

yes your right the bottom loop is not needed, the wait was so I can see what the code was doing while it was executing.

 

Am sure there is a more elegant of writing this code and that is why am here on this forum to get serious help and advice

 

Thanks

 

Thomas

0 Kudos
Message 9 of 17
(3,756 Views)

Hello Bill,

 

also i do not want to force any of the values into range and how will boolean pass any value i want to keep into another array please read carefully as to what i am trying to do

 

Kind Regards

 

Thomas

0 Kudos
Message 10 of 17
(3,751 Views)