LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to read calibration data from a file

Solved!
Go to solution

I have some calibration data from an experiment. There are 14 channels and the data is arranged in a spreadsheet 14 rows x 4 columns, where each column is a different constant from a best-fit equation of the form y = b1 + b2.x1 + b3.x2 + b4.x1.x2, per channel.

 

I need to get the data into labview so that I can use it during an experiment. Can anyone recommend the best way to do this? I've tried the 'read from spreadsheet file.vi' but can't get it to work. Any recommendations or example code? Or do you think it is better to use a text file?

 

Thanks

Dave

 

 

0 Kudos
Message 1 of 17
(4,849 Views)

Hi Dave,

why does the "Read From Spreadsheet File.vi" not work? Where do you have problems?

You have to set your used delimiter.

 

Mike

0 Kudos
Message 2 of 17
(4,846 Views)

Dave,

 

Exactly what did not work?  Spreadsheet files may be tab or comma delimited text files or in some proprietary format such as .xls.  How is your file formatted?

 

How is the data generated?  Is it from a LV program or from some other program? If LV generates it, either the Config file VIs or the read from spreadsheet VIs should work.  If it is in some other format, then you need to find a way to read that format.

 

Lynn 

0 Kudos
Message 3 of 17
(4,844 Views)
it's an xls file from excel. I could also save it as a text file I guess. basically I wrote a small test program with just the read the data and display it on screen; nothing appear (just zeros). I just wired controls or constants to the different inputs on the read from spreadsheet vi.
0 Kudos
Message 4 of 17
(4,841 Views)
The Read From Spreadsheet File does not read Excel files. It works with text files that are formatted in a "spreadsheet-like" way. This function has been misnamed from day 1, and it has caused a LOT of confusion. You can either save the file as a text file, or you can use ActiveX to read Excel. You can find examples on how to do this at the Excel thread.
0 Kudos
Message 5 of 17
(4,836 Views)
wow! that is a brilliant way to mislead a newbie if ever I saw one. Why doesn't someone tell National Instruments to make that OBVIOUS in their help file!!!
0 Kudos
Message 6 of 17
(4,833 Views)

The context help does say "Reads a specified number of lines or rows from a numeric text file..."

 

Its the fine print which get you. 

 

The real problem is that too often the equation "spreadsheet = Excel" is assumed to be true. 

 

Lynn 

0 Kudos
Message 7 of 17
(4,828 Views)
so....going back to my original question: what method do you recommend? a text file (CSV or tab delimited)
0 Kudos
Message 8 of 17
(4,826 Views)

They do. From the Help file:

Reads a specified number of lines or rows from a numeric text file beginning at a specified character  ... can use this VI to read a spreadsheet file saved in text format.

 

Note: The underlining is my emphasis. Still, I understand what you're saying, and as I said, it's been poorly named from the beginning. Smiley Wink

0 Kudos
Message 9 of 17
(4,826 Views)
Solution
Accepted by topic author oilyfingers

oilyfingers wrote:
so....going back to my original question: what method do you recommend? a text file (CSV or tab delimited)

It doesn't matter. You just need to wire the correct separator character to the delimiter input of the function. It defaults to a tab, so if you save the file as CSV, then wire a string constant to that input with the string constant set to a comma. 

0 Kudos
Message 10 of 17
(4,819 Views)