10-25-2019 10:33 AM
Hello community,
Recently i have been working with a problem that is not easy to solve for me with labview.
What i want to do is to fill array with zeroes on indexes that are not included in second array.
For example:
Array 1 = [1,5,7,15,16,19,20,25,30,44,93,...,n]
Array 2 = [0,3,4,7,9]
And the result would be
Array 3 = [1,0,0,15,16,0,0,25,0,44,0,...0]
Is there any easy and fast way to do it? I have been trying with For loops and index array function but it was not working as I wanted (returned me array without any changes, here it would be Array 1)
I know it's not complicated problem but I am new to labview and programming.
Best Regards
Andrzej
Solved! Go to Solution.
10-25-2019 10:42 AM
Hi Andrzej,
This sounds like a work around for something that might be easier to do if you tell us the background of the problem. But, to do what you requested you can loop through your Array 1 and see if the current index is found in Array 2 (Data to Keep). If not, replace it with a zero.
10-25-2019 10:57 AM
10-25-2019 11:52 AM
10-30-2019 12:41 PM
Initialize Array 3 with zeros using the size of Array 1
Loop over Array 2 elements as indices and replace the contents of Array 3 index with Array 1 index.
11-03-2019 09:50 AM
Hi Gregory,
Thank you for the response. This solution is really simple and works pretty well! Thank you 🙂