LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

match values in array

Hi,
I wrote a program which takes a data file a breaks the data up into 10 different ranges.  The ranges are based on the minimum and maximum values in the array, at a specified column.  I need to be able to search through the the sorted array and find repeats of the same values, take the entire row of the repeat and add certain columns to together between the rows.  I was able to find a post that generated the indices of the matches, but i can't seem to get the correct indices.  Here is an example of how the data file would be laid out:
 
.3202,55,14,78,23,5,6,7,8
.3202,89,3,4,5,6,12,3,49
.3202,65,43,2,5,12,45,67,89
.3614,67,54,23,1,2,3,4,5
.3614,10,23,24,25,54,56,57,65
.4026,23,90,87,65,45,34,35,21
 
I need to be able to take 55+88+65,14+3,+43,etc.  Should I try and store the matched items in their own seperate array?
 
Adam
 
Download All
0 Kudos
Message 1 of 3
(2,661 Views)

Hi,

Sorry for the typo, I've been coding for most of the day so my brains a little fired, I ment to type:

I need to take 55+89+65,14+3+43,etc

67+10+23,54+23+90,etc.

In short if I find a match, I need to add down the columns of the matches.

Adam

0 Kudos
Message 2 of 3
(2,657 Views)
A simple solution could be :
Repeat
- read a line
- get the first value
- search for it in the result table
     if found, then add data
     else create a new entry
end repeat
See the attached vi.
Should work if your file is not too large. Otherwise, deserves some array manipulation optimisation, to avoid many memory re-allocations !

Message Edité par chilly charly le 10-24-2007 05:37 AM

Chilly Charly    (aka CC)
Download All
Message 3 of 3
(2,648 Views)