01-24-2012 04:47 PM
I want to create a simple VI application. The VI will read in 2 1-D array & compare the data between these 2 arrays. I want to store the data as well as the index when the condition is true. Since the output of the comparision function is boolean, how can I retrieve the data when the condition is true? My model could be messy since I am still debugging.
Thanks in advnace
01-24-2012 09:26 PM
How's this?
Depending on the structure of your input file, you might want to transpose the array before the loop.
01-27-2012 09:31 AM
The "Select" function will return both data depedning on the comparasion result. I only want to store the data when the condition is true. I am still debugging, thanks.
01-27-2012 09:46 AM
If you (and LandBelanky) are not familiar with the simple case statement, please see LabVIEW 101 tutorial.
01-27-2012 01:00 PM
Land Belenky is very familiar with how case structures work, Beotch.
If anyone had bothered to look at the code I wrote, they would see how it works.
The select function is triggered by the condition. If the condition is false, it returns only the previous results and does not include the current values. In that way, it does not store the data when the condition it false. It ignores it and goes on to the next iteration.
If the select function is true, it adds the current value to the previous and returns both.
Have you tried running the VI I wrote? I tested it and it appears to do exactly what you requested. I tested it with the following input array:
0,0
1,1
2,2
3,3
0,1
0,2
0,3
0,4
1,1
You will notice that the 0th, 1st, 2nd, 3rd and 8th rows have a match. Therefore these indexes and values are recorded in the output. The 4th, 5th, 6th and 7th rows do not have matches. Therefore, neither their indexes nor their matches are reported in the output.
It produces the following output:
0,0
1,1
2,2
3,3
8,1
The first colum is the index of positive matches. The second column is the values.
I really think that's what you requested. If you're still having a problem, please be more clear about what you're looking for.
01-27-2012 01:11 PM
@LandBelenky wrote:Land Belenky is very familiar with how case structures work, Beotch.
Unless you are good friends with Dennis, I would refrain from this kind of comment in a post.
Save this kind of language for Facebook and Twitter...
01-27-2012 01:13 PM
The question was how to store data when the condition was true, not to always store data.
01-27-2012 01:36 PM
I think it would help if he could be more specific about what "the condition" is.
My VI does a pair-wise comparison of the elements in the two columns. If (and only if) the values of the two elements are identical, it considers the condition to be true for that pair and therefore saves that data in the final result. That seems to be what he was attempting to do in his original VI.
From the phrasing of the original question, it's not really clear what he considers "the condition" to be. Perhaps he's trying to compare the arrays in aggregate and then save the data only if ALL elements match. In that case, the solution is trivial.
The VI I presented works as described. If anyone wants it to work differently, they'll need to describe the desired outcome better.
If anyone else would like to offer a solution, that would also be allowed.
01-27-2012 01:40 PM
I will resume to work on my application on Monday. Please keep sending me the solution if any. Thanks.
02-02-2012 01:24 PM
Your model works with 2 columns of spreadsheet of data. I was trying to read a one-column of spreadsheet data & to check if there are 2 consecutive rows of identical value of data. The attached file was created to test the application & the output is incorrect. The identical data are at row 26 & 27 (value is 25).