10-20-2010 09:48 AM
This will likely be a very stupid question, but is there anything I could be doing wrong when trying to get a 2D array from an Excel file? The file contains two columns of data which I want as a 2D array (or two 1D arrays) and having tried a couple of things I'm not getting anything up on my graph. The VI attached is a work in progress and has been hashed together from some other work (it will be used to control scanning mirrors).
Thanks in advance,
Ben
Solved! Go to Solution.
10-20-2010 10:18 AM
Are you trying to read an actual Excel file ( .xls ) or a delimeted/spreadsheet text file?
10-21-2010 06:10 AM
Hi Ben,
Could you please post the actual file that you are trying to read from or a representative one if that is not possible. Also could you send the actual file I/O code you are working on, which has been cut back to only the file I/O part. This will allow me to run the code and see your exact problem. I will then be able to advise on how to overcome the problem.
Best Regards,
Christian Hartshorne
NIUK
10-22-2010 05:22 AM
The file is saved as a .csv file, I've tried saving it as a .xls but it hasn't made any difference. The file is generated using a fairly simple python code, with an example attached. I realise I'm probably missing something very obvious, so thank you for being patient!
Ben
10-22-2010 11:13 PM
Your file is a CSV comma separated file. The Read from Spreadsheet File has a default delimiter of a tab.
Wire a string constant with a comma into the delimiter input of the Read from Spreadsheet File and it will handle your CSV file correctly.
10-25-2010 10:12 AM
Hi Ben,
I have found a Knowledge Base article which relates to your exact problem. I have linked this below.
Reading Microsof Excel Numeric Data into LabVIEW
Having followed the steps in the KB, I changed the file to a text (.txt) file and was then able to read the data successfully and plot it on the XY Graph using a modified version of your code that only contains the File I/O element. If you make the necessary changes to your data file and then reference it in the modified VI that I have attached, this will illustrate how you can read your data into LV.
I hope this helps.
Best Regards,
Christian Hartshorne
NIUK
11-02-2010 11:30 AM
Thank you, changing the file type solved the problem!