LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sorting input files

I have a handed-down vi for a spectrometer which I'm trying to adapt. The program currently combines adjacent files from a file list in order to produce a complete spectrum. I want to A: figure out how it chooses the files to compare, and B: adjust it to combine alternating files to form the spectrum. Any suggestions on how it might be sorting the files, or how to change it to sort how I need it to?

 

 

Appreciate any help,

Lostpchemist

 

 

BTW, I'm using Labview 7.1 for this.

0 Kudos
Message 1 of 6
(3,004 Views)

Hey,

 

First of all u need to design/decide the algorithm for sorting, for example common requirement is to arrage file name in alphabetical order..U need to pass adjacent file name (converted to lower case) through "string to byte array" function.. this will convert  string into an array of unsigned bytes with each byte in the array has the ASCII value of the corresponding character in the string..

 

This ASCII conversion will enable you to just define sorting as per numeric compare.. u can use for loop to compare element by element of array.. based on ur compare results either u can swap the file name or continue for another file.. I think u got the idea to go ahead with coding..

 

Hope it helps

 

HS

0 Kudos
Message 2 of 6
(2,992 Views)
It's kind of hard to help when you forgot to attach the .vi you are talking about.  Smiley Wink
0 Kudos
Message 3 of 6
(2,991 Views)
Here's the vi I'm using, by the way. I hope it posts ok.
0 Kudos
Message 4 of 6
(2,980 Views)
sorry- most updated kinda-working version.
0 Kudos
Message 5 of 6
(2,975 Views)

Hello Lostpchemist,

 

I looked over this code and as far as I can tell, the only sorting is done by the List Folder VI that provides the list of VIs in the folder. This sorts the VIs in alphabetically order. Also I noticed that the Path control states that this folder only can contain .csv files which is not the case if you give a pattern to List Folder VI of *.csv. This statements tells the List Folder VI only to return .csv files.

 

In order to combine these, he copied the array of names and removed the first element from one array of names and the last element of the other array. From here he combined the files so that the file in element zero combines with file in element one and so on.

 

Other than that, it will be hard to decipher what the other parts of the code is doing without knowing the structure of the file. What I would suggest would be to use the debugging tools in LabVIEW to walk through this code step by step to see what is happenning in it. In order to do this, I would use Highlight execution, probes, and single stepping. Most of the links refer to LabVIEW 2009 but a lot of the functionality hasn't changed with this. If you need more detail help with these, you can find them in the LabVIEW 7.1 help.

 

I hope this information helps you with this and if you are still having problems, feel free to post.

 

JimS.


Jim St
National Instruments
RF Product Support Engineer
0 Kudos
Message 6 of 6
(2,918 Views)