LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Display entire text file w/ tabs intact

Here's an example that converts a (well behaved) tab-separated multiline string (e.g. as read from a file) into a 2D array of strings, suitable for a table display.

(I only spent a few minutes to wire it all up and there are many other (and probably better) ways to do this. This particular example uses "scan string for tokens").
Message 11 of 16
(1,111 Views)
Excellent! This vi did approximately what I attempted on my own, though I used nested while loops for the rows and cells instead. Mine did not work. (It put everything into array element 0,0.)

I then re-created your code slightly adapted for my application. It still put everything into 0,0.

Finally I started with a blank vi and wired up an EXACT COPY of your code, even using exactly the same string content... and it did not work. (0,0 again)

The only difference now that I can see between your vi and mine is that I am using LabVIEW 7.1 (Base) with Windows XP, while you are apparently using 6.1 . Please see my attached copy of what you sent.

Thanks very much,
Aaron.
0 Kudos
Message 12 of 16
(1,111 Views)
Ok, this was extremely helpful. I KNEW there was a way to launch an external program, just didn't know what that way was. This is what I originally wanted to do before getting mired in string arrays and all that.

Thank you,
Aaron.
0 Kudos
Message 13 of 16
(1,111 Views)
Obviously, it is not an exact copy, or it would work, right! 😉 You need to set your delimiters to "'\' codes display" when copying my entries.

You set the delimiters to "\n", "\r", "\t" in normal text display with the obvious result that these exact strings are very rare in your file and nothing is found). When set to normal display, the correct delimiters should be invisible (newline, return, and tab, resp).

Solution: set the delimiters to "'\' Codes display" (right-click), then delete the extra "\" in each constant.

(BTW: I actually use LabVIEW 7.1 almost exclusively, but made a 6.1 version so more users can open it.)
Message 14 of 16
(1,111 Views)
Thanks! I was not aware that codes could be changed in string constants on the block diagram. Now that I have that straight, everything works great (even my code with nested while loops).

Aaron.
0 Kudos
Message 15 of 16
(1,111 Views)
Sorry, I wasn't aware that "spreadsheet string to array" can be used to create string arrays. This is a simpler solution in the special case where you only have one type of delimiter.

See attached example.
Message 16 of 16
(1,111 Views)