zero-tolerance Posted October 11, 2007 Report Share Posted October 11, 2007 Hi I'm trying to make a program that can sort out this text file alphabetically. The example is as follows:<BR><BR>I have a list of all my CD where they are each placed on my CD case holder. For easy finding each CD slot on the case has a number from 0 to 500. So I have made a lit of all my CD's using excell. So when I'm looking for a CD I look for the name on my list (which is sorted alphabetically) and then just check the number next to it. My list looks something like this: 126 <Tab> Big Bear 125 <Tab> Panorama 173 <Tab> Small Bear etc.... The Above Example is alphabetically in order depending on the CD name and not on the number next to it. I have allready made a program that automatically searches the list based on CD name and adds the new CD with the number next to it on the text file, but when I add the new Name it is not appearing alphabetically, i.e. I can put the list on the ascending order based on the number but not based on the CD name. Any help appriciated Thanks Quote Link to comment
Michael Aivaliotis Posted October 12, 2007 Report Share Posted October 12, 2007 Try using the "sort array" function in the array palette. Quote Link to comment
zero-tolerance Posted October 12, 2007 Author Report Share Posted October 12, 2007 QUOTE(Michael_Aivaliotis @ Oct 10 2007, 10:07 PM) Try using the "sort array" function in the array palette. I allready did that but the sort array function only works by looking at the first "character" where in my case would be a number i.e. 123 "CD Name". So it sorts it out based on the numbers that are at the beginning of each element of the array. But in my case I want to sort them based on the "CD Name" but when sorted I still want to keep the ascociated number that goes with it. I have somehow managed to do this but I'm not too happy with the way I have done it. I'm thinking that there must be a much better way of achieving the same results. The attached program is an example of what I'm woring on and its on two versions of LabView (8.5 and 8.2). Please ask if you need for version 8.0. Any help appriciated. Thanks Quote Link to comment
ned Posted October 12, 2007 Report Share Posted October 12, 2007 QUOTE(zero-tolerance @ Oct 11 2007, 10:25 AM) I allready did that but the sort array function only works by looking at the first "character" where in my case would be a number i.e. 123 "CD Name". So it sorts it out based on the numbers that are at the beginning of each element of the array. But in my case I want to sort them based on the "CD Name" but when sorted I still want to keep the ascociated number that goes with it. I have somehow managed to do this but I'm not too happy with the way I have done it. I'm thinking that there must be a much better way of achieving the same results. The attached program is an example of what I'm woring on and its on two versions of LabView (8.5 and 8.2). Please ask if you need for version 8.0. Any help appriciated. Thanks Bundle the CD Name and the number into a cluster, with the CD Name as the first element. Build an array of those clusters, one for each disc. Sort the array of clusters using Sort Array. Unbundle the cluster and write out your file. Quote Link to comment
eaolson Posted October 12, 2007 Report Share Posted October 12, 2007 QUOTE(Michael_Aivaliotis @ Oct 10 2007, 11:07 PM) Try using the "sort array" function in the array palette. Also, the OpenG Sort Array function allows you to sort a 2D array by a particular column. Put your number is the first column, the names in the second, then sort on the second column. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.