Search code examples
commentslabview

How do I ignore comments in a text file with LabVIEW?


I've created a script file reader, nothing more than a glorified text reader that changes loop cases in my program, but I need it to be able to ignore comments on a line, execute that command, and go to the next line and process the new command after it finds the comment denoted with a semicolon. For the life of me, I can't figure out how to do this.

Currently, the commands are read in like this:

 DO THIS FUNCTION
 DO THAT FUNCTION

I'd like to comment it with a semicolon like this:

DO THIS FUNCTION ;this is a comment to be ignored

Below is my text file read code, should be able to drag and drop it in to test. The command indicator just echoes the command being read. I've removed the rest of my program, sorry, can't send that part.

Can someone shed some light?

Text File Reader


Solution

  • Is a semicolon used anywhere else in your file? Or is it just used to indicate a comment?

    If it is only used to indicate a comment then as you read each line in, call the Split String primitive and split at the ";". Just use the top output regardless of whether or not the line contains a semicolon:

    enter image description here