LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

whats the problem in the coding

My program does not write a sorted output to the output file.
Can you please let me know why?
Please select a file where the data to be sorted is entered and another file where the sorted data must be stored.
0 Kudos
Message 1 of 5
(2,902 Views)
It's not clear to me what you're trying to sort. Is it each line in a file? If yes, then you need to put each line into a separate array element. The way you're doing it now, the entire file content is a single element. If you want to sort a single line by characters, you have to do the same thing - put each character in it's own array element. If you would attach a sample text file with more details, it would help a lot.
0 Kudos
Message 2 of 5
(2,902 Views)
Because the net result of your vi is to merely capitalize everything you are reading in. Everything after the capitalization cancels itself out (like saying 2+3+5+6-6-5-3 = 2). When you read in the file, it's taken in as 1 long string. With no parsing of the string to array elements based on space, CR, LF, etc. it's just 1 long string. If I'm correct in my thinking of what you're trying to do, you should read in the file as a spreadsheet string with whatever separator is appropriate.

If you place probes or indicators all along the data flow, you'll see what's happening.

Dave.
==============================================

0 Kudos
Message 3 of 5
(2,902 Views)
Thanks for the response. I want every element to get into an array element so that i get a sorted output.
Enclosed is a sample text I would like to sort.
0 Kudos
Message 4 of 5
(2,902 Views)
I modified your code for sorting. You can use probes and indicators to see how it works.
Download All
0 Kudos
Message 5 of 5
(2,902 Views)