LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read text spreadsheet labview 7.1

Hi all,

I am having a distinctly annoying problem.  I can't get "read from spreadsheet" to read a spreadsheet with text entries in Labview 7.1.  I have tried this in 8.2 and it seems fine.  In 7.1 I can't get the array (of text entries) to read into string functions.  It appears LabView believes that "read from spreadsheet" only produces numeric arrays.  Is there a way to correct this so that labview recognises the data coul be a string?

I apologise if this problem has been raised already.  I had a search around the ni forum, but couldn't find it.

Again any help would be geatly appreciated!

Thanks
0 Kudos
Message 1 of 9
(4,886 Views)
Open the block diagram of the "read from spreadsheet" vi. The comments explain how modify the vi to read strings, just make sure you make a copy of the original vi first.
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 2 of 9
(4,883 Views)
Read the file as a plain text string and then use "spreadsheet string to array" with %s as format and an String array as type, and the correct delimiter charater (if not tab).
 
 
No need to modify any VIs.
 
Message 3 of 9
(4,871 Views)
Thank you both.  This is very helpful.  I'm afraid I don't have any idea how to make a blank string array to put into the "Spreadsheet String To Array".  This seems like it should be the most simple and straightforward thing! I am more than a little ashamed that I haven't figured it out!

I am assuming that this is the reason that my output is still an array of zeros (correct dimension, though) instead of the words themselves.

Could you point me towards the option to make a numeric constant into a string, please?
0 Kudos
Message 4 of 9
(4,849 Views)


pickslide5 wrote:
Thank you both.  This is very helpful.  I'm afraid I don't have any idea how to make a blank string array to put into the "Spreadsheet String To Array".  This seems like it should be the most simple and straightforward thing!
One possibility:
Right-click on the "array type" terminal and select create constant. Now right-click on the array element (not the array container) of the array diagram constant, select "replace...", and select the "string constant" from the string palette.
 
Another possibility:
Drop an empty array container from the array palette on the diagram. Now drop a "string constant" inside it. Resize the index terminal for a 2D array (just resize so two indices show).


Message Edited by altenbach on 04-19-2008 11:45 AM
Message 5 of 9
(4,845 Views)

Hey guys,

 

Just wanted to share that if you need to read a spreadsheet in a string format you can use the "Read lines from File".vi

 

 

Read Spreadsheet as string.png

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 6 of 9
(4,425 Views)

@REDS wrote:

Just wanted to share that if you need to read a spreadsheet in a string format you can use the "Read lines from File".vi


How old is your LabVIEW version????? (I know this old thread is about LabVIEW 7.1, but why dig up ancient things. It is irrelevant form most of today's users)

 

All newer LabVIEW versions could use "read text" with the option "read lines", but that still would not be a reasonable choice, because "spreadsheet string to array" correctly treats linefeeds as row breaks anyway.

 

 

0 Kudos
Message 7 of 9
(4,414 Views)

I just had a customer who was coincidently using LabVIEW 7.1 and couldn't get to read a spreadsheet as a string.

Regards,
Daniel REDS
RF Systems Engineer

Help us grow.
If a post solves your question, mark it as The Solution.
If a post helps, give Kudos to it.
0 Kudos
Message 8 of 9
(4,412 Views)

Ah, OK. I don't even remember exactly what "read lines" did in these old days. 😄

0 Kudos
Message 9 of 9
(4,410 Views)