LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read a string text file and transform it into string array

Hello
How Can I read a string txt file and transform it into a string array ?
The function SpreadSheet To Array seems to accept only dbl type array?
Is it possible to modify the array type ?
0 Kudos
Message 1 of 12
(43,248 Views)
You can modify the original Read from spreadsheet file VI to read a string array by double clicking it, just make sure you don't overwrite the original file. I'm attaching a quick and dirty example.

___________________
Try to take over the world!
Message 2 of 12
(43,241 Views)

@OBN wrote:
The function SpreadSheet To Array seems to accept only dbl type array?



Wrong ! Just wire a string array constant as input (bottom left) as in the attached example.

Happy New Wire !

CC
Chilly Charly    (aka CC)
Message 3 of 12
(43,235 Views)
Thank-you

But how do you change the type of the "SpreadSheet String to Array" from Array Type "2D Dbl" to "string"?
0 Kudos
Message 4 of 12
(43,233 Views)
Hi Charly

May you save in 7.0 version?

Regards

Happy New year to you also
0 Kudos
Message 5 of 12
(43,230 Views)
Here it is !

CC
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 12
(43,226 Views)
Cool Thanks
0 Kudos
Message 7 of 12
(43,223 Views)
HEY! CC! Don't be so judgemental. Be more Chilly.
First, it works. So even if it's problematic it isn't wrong. Second, the reason I prefer this method is that it allows you to read spreadsheet files that have text as well as numbers.
As for OBN's question of how to replace the DBL array with a string one - after you double-click the read VI, find the 2D DBL array on the right, right-click one of the controls and from the pop-up menu select replace and select a string control instead. Just remember (very important) to save the file under another name so that you don't overwrite NI's VI.

___________________
Try to take over the world!
0 Kudos
Message 8 of 12
(43,221 Views)
O.K. CC, here's an apology. I misread your post.

___________________
Try to take over the world!
0 Kudos
Message 9 of 12
(43,207 Views)
Also, I just wanted to say that the read VI itself has a "format" input, although from what I could tell, it doesn't convert to string.

___________________
Try to take over the world!
0 Kudos
Message 10 of 12
(43,203 Views)