LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find largest number from text file

Solved!
Go to solution

I am using the "Read from text file" block to read the data from my .txt file into labview.  It is now in string format.  I have many numbers in the file.  

 

For example:

0.45

0.35

0.12

1.354

1.56

2.89

5.89

0.56

 

That is what a text file might look like.  I want to find which of these numbers is largest, and do calculations with that number.  I am having trouble with strings/number formats/arrays, etc.  Thanks

0 Kudos
Message 1 of 7
(3,661 Views)
Solution
Accepted by topic author Benjammin0789

Try reading the file with the Read From Spreadsheet File.vi with Transpose set True. Then use Array Max & Min to get the largest number in the array.

 

Lynn

Message 2 of 7
(3,656 Views)

Yes, that works.  I guess I couldn't get past the thought that my text file is not a spreadsheet, and so I assumed that read from spreadsheet vi would not work.  Thank you.

0 Kudos
Message 3 of 7
(3,652 Views)

The spreadsheet functions and VIs typically work on strings representing numbers separated by delimiters.  This is a typical way to save a "spreadsheet" (of numbers) to a text file, for example .csv files.  These are quite versatile and powerful functions.  Spend a bit of time becoming familiar with them because you may find yourself using them a lot.

 

Lynn

0 Kudos
Message 4 of 7
(3,648 Views)

Right on.  Now, do you have any idea how to delete text files from an sd card?  After I grab the data, I want to wipe the sd card clean from labview with a button and be on my way.

0 Kudos
Message 5 of 7
(3,643 Views)

File I/O palette >>  Advanced File functions >>  Delete File.

 

The SD card should have a drive letter assigned, so you just use that in the path you send to the delete file function.

0 Kudos
Message 6 of 7
(3,638 Views)

Yes, thanks

0 Kudos
Message 7 of 7
(3,633 Views)