08-21-2017 09:18 PM
Hi,
I am extremely new at LabVIEW programming and wish to implement a basic read file from text file.
So far I have this set up:
I got the compound arithmetic function to output true for both conditions, but I am confused as to how with that boolean condition to make the program pass along the file.
In addition, is there a function to read incoming text files with numerous columns and fix the spacing between columns to be read into an array and utilized?
08-21-2017 09:35 PM
I don't understand what you mean by "as to how with that boolean condition to make the program pass along the file.".
I don't understand what you mean by " fix the spacing between columns to be read into an array and utilized", but if you want to read a text file with data formatted into columns, use Read from Spreadsheet File.
08-21-2017 09:43 PM
Sorry I wasn't clear with my first post.
What I meant by "as to how with that boolean condition to make the program pass along the file" is when a user selects a file from the browser button, my program will check if it's an existing file and also if it has the right extension (which is a .txt file), if both conditions hold true, then the program will continue with that file and pass it along to be used for other functions.
"fix the spacing between columns to be read into an array and then utilized" is meant by fixing the spacing between columns of data in a txt file. Some of the columns have 2 spacing between and others have 4 spacing between them. I wish to make them one spacing apart, in other words, to manipulate the incoming text file so it's easier to be read by the program into an array.
08-21-2017 11:00 PM
@TeddyLu wrote:
I got the compound arithmetic function to output true for both conditions, but I am confused as to how with that Boolean condition to make the program pass along the file.
Does the program in need of, checks for extension file to be .txt file (in this case) and passes only files with such extensions..?! Am I clear..
If so, you can achieve the same with above code..
08-22-2017 12:58 AM - edited 08-22-2017 12:59 AM
Hi Teddy,
when a user selects a file from the browser button, my program will check if it's an existing file and also if it has the right extension (which is a .txt file),
Using the FileDialog ExpressVI you can configure it to select only existing files and you can provide a file pattern (like "*.txt") to only show files with correct suffix…
(It's not fool proof, but will help a lot!)
if both conditions hold true, then the program will continue with that file and pass it along to be used for other functions.
So you want to implement something like
IF statement THEN do something
IF-THEN-ELSE usually is done in LabVIEW using a case structure…
08-22-2017 05:21 AM
use a case structure and pass the path if the extension is matching and use scan from string function might help you in the spacing problem
08-22-2017 08:35 AM
In case of state machine based on the Boolean case can be selected.