09-08-2016 09:38 PM
Hi all!
How to compare two 1D array and if both of the 1D arrays have the same elements (eg: the first is 123456 and the second array is 123456), I want to store the data in another array. If false, it will just ignore the data and continue to check the next arrays.
Below I attached the screenshot of a part of my code.
09-08-2016 11:41 PM - edited 09-08-2016 11:43 PM
Are you by any chance checking for palindrome numbers? Some things I noticed were that you can auto index the array inputs as well instead of indexing an input array. I don't have LabVIEW in front of me but I thought running an equals on two arrays will compare return a Boolean array in which case you will have to and the array elements.
To answer your original question though, if you right click the auto indexing tunnel coming out of the for loop you would want to enable the conditional option (if your LabVIEW version has it) otherwise you are going to have to build that yourself using a build array and case structure. The conditional tunnel will add a Boolean input to the tunnel which will only add the output to the array if that condition is true.
09-08-2016 11:52 PM
Do you want to store both the array or only one array (if both array matches)
Comapre two arrays and use conditional indexing, index only if the output of array comparison is true.
09-09-2016 02:17 AM
Thank you for your reply.
In my case, I want to store only one array. Anyway, I think I got the idea already on solving that by using 'Build Array' (please suggest if you know any better ways) .
Now I'm thinking of ways to convert all elements in the array into an integer (scalar) if the case is true.
09-09-2016 02:19 AM
Thank you for your reply.
Yes.. I am coding a program that can output all palindrome numbers in given range.
09-09-2016 02:22 AM
its always better to share code than image..
09-09-2016 02:28 AM
This is my code.
09-09-2016 02:54 AM - edited 09-09-2016 02:56 AM
Instead of "Build Array", you can directly connect the array to the loop, and select tunnel as concatinating and conditional. So your code will be looking clean.
09-09-2016 03:38 AM
Modified snippet
09-09-2016 06:39 AM
Would you mind to explain how do you set the output tunnel of the for loop?