LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Advance text file search

Hello,
 
I am having problems in understand on how to carry out searches in Labview. How can I search the text file or spreadsheet to find the Top 3 most common type of forname given that there age is 16, 17 or 18. At this moment i have not clue on where to start to create some like this. I understand it will have to go into an array, but after that point i am not sure.
 
 
Thank you
 
KING1
0 Kudos
Message 1 of 7
(3,621 Views)
Hi King,
read in the file in a whole and use "spreadsheet string to array" with tab as delimiter (default), then you get a 2D- string-array. Then you can put the elements of a row in a cluster and sort the array of the clusters in the way you need with "sort 1D array".
If you have difficulties in programming that, don't hesitate to ask.
Greets, Dave
Greets, Dave
0 Kudos
Message 2 of 7
(3,610 Views)

Hi,

I have got the data into an array and can read it all fine, with you idea will i be limited by the cluster or will this method operate on 100s of rows of data. I am not quite sure on what you meant could you give an example how you could select the TOP 3 forenames given their age is 16,17 or 18. You help would be very welcome

 

thanks

King1

0 Kudos
Message 3 of 7
(3,605 Views)
Hi King,
That's right, it wasn't enough what I suggested. I thought a bit deeper and made the attached VI. It was fun. I hope it does what you need.
Greets, Dave
Greets, Dave
0 Kudos
Message 4 of 7
(3,590 Views)
Hi,
 
Thank you trying to help but it is not what i was after, i am sorry if i did not explain it well but i will try again. From the data i would like to find the top 3 occurances of the forename given that their age is 16,17 or 18. From the data the output should be:
 
Forename                       Number occurances         Age
Ryan                                4                                       18
Rob                                  3                                       16
Katie                                 2                                      17
 
These are the answer, as they are the top 3 name given that their age was 16,17 or 18. I am not just trying to find the most common name, I am trying to find the 3 most common forename given that their age is one of the three number.
 
Thanks
 
KING1
 
 
0 Kudos
Message 5 of 7
(3,585 Views)
Hi King,
now I'm not on a computer with LV, but as a quick fix I would suggest to run the code after the "spreadsheet string to array" several times with different ages (when you run the VI in highlighted mode you can see how it works), taking after each run the first element of [TOP 3] indicator.
On monday I'll be back... Smiley Happy
Greets, Dave

Greets, Dave
0 Kudos
Message 6 of 7
(3,578 Views)
Hi King,
this VI is not very clever now, since some code is unnecessarily done multiple times, but it works. As you can see, it does the work of the old VI in a loop and collects only the first elements.
Greets, Dave
Greets, Dave
0 Kudos
Message 7 of 7
(3,556 Views)