LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i read txt file then take parts of it to be put into excel

The Read From Text File vi can be used to read lines from file (right click menu -> read lines). You can then use regex to parse the informations that you want. Attached is a modified version of majoris vi.

 

I recommand this site http://www.regular-expressions.info/ to get more familiar with regex.

 

Ben64

 

parse file.png

0 Kudos
Message 11 of 15
(713 Views)

It is not very clear what you want. I think this is the first time that your talking about matching a command. If this is want you want you just have to use the vi majoris or I posted and stop the loop on a command match, then take the timestamp that correspond to this command.

Ben64

0 Kudos
Message 12 of 15
(711 Views)

Yes i would like to be able to sort through commands from left to right so i can say alright i want this command then this command then this command...ect. and be able to sort out all lines that match the commands for a start and an end to subtract their timestamps and get multiple times to monitor how long each strat line to end line took to plot.  I am having trouble getting either of the vi's to work would you suggest me doing a sequence structure with a case structure in each to select each command  and having two of these for the first line (start command) and for the second line (end command). also how can i get the vi to select every one of the start and end lines for that specific command instead of just the first one that comes up.  I appreciate you all for bearing with me on this subject.

Triff

0 Kudos
Message 13 of 15
(700 Views)

It would help to give us an example of the output that you want.

 

Ben64

0 Kudos
Message 14 of 15
(692 Views)

I'm getting the feeling that what's really needed here is a review of Labview itself. I'd seriously recommend reviewing the tutorials on this website and elsewhere to understand all that Labview can do. Once you're comfortable with alot of basic Labview concepts, this should be a breeze for you (Regular Expressions notwithstanding).

 

No need for the sequence structure: In fact, as a rule, you should avoid it at all costs. What you want to do at a high level is make a VI for parsing each line of the input. You do this by putting your parsing VI in a while/for loop that is autoindexed on the array of command lines. Once you do that you can do alot of stuff. For instance, once you parse the data (and maybe turn it into a useful format... i.e. turning those text time stamps into numeric seconds, or milliseconds), still inside the for loop, you could then collect all the similar commands into seperate arrays. Then you can go through those arrays (with a different for loops) and subtract every pair of commands (which are the same) giving you the time in between each command start and command end for that command. A case structure based on the command is likely necessary for what you do, and as long as your commands are sufficiently predictable, you can wire the output of regular expression match for the command: (Cmdr2|...) to a case structure and then write in each command case to handle it differently.

 

There's probably like 100 more ways to do it. Depends on a lot of different factors.

0 Kudos
Message 15 of 15
(691 Views)