ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create an array from parts of a CSV file

Greetings.  I am trying to write a VI that will locate data in a *.csv file.  The data is in columns of an unknown number (anywhere from 10-128), but the columns of interest will always have the same title.  Is it possible to pull only the desired columns of information from the *.csv?  I have reviewed the other posts that deal with taking information from csv files, but they do not seem to be dealing with the same volume of information as I am.
 
Thank you all in advance!
0 Kudos
Message 1 of 6
(3,794 Views)
Assuming the titles of your columns will be the same in each file, here is one way to extract the desired columns.  You can modify it if you need the data in DBL's.
0 Kudos
Message 2 of 6
(3,785 Views)
You should be using the Read From Spreadsheet as string type. Then you can use the Search 1D Array on the first row output to find the column you want. You can then pass this value to the Index Array function to get the column you want. If you need multiple columns, put the search inside a for loop and pass in an array of colum names.
0 Kudos
Message 3 of 6
(3,783 Views)
Thank you both for your help so far.  However, I am still having difficulties. 
 
Using a string variable and limiting the length of the output to 1, I have been able to call one column of data in the desired fashion.   However, when I use for loops to call more than one variable at a time I run into some problems.  It seems to be from the indexing.  I believe that I need auto indexing when my array leaves the for loop, but not when the full array enters the loop.  This causes wiring errors.  I have also attached an image of this VI.  Any advice?
 
Thanks!
 
Download All
0 Kudos
Message 4 of 6
(3,739 Views)
Try this.

Message Edited by Dennis Knutson on 07-15-2008 08:20 AM
0 Kudos
Message 5 of 6
(3,729 Views)
That did the trick.  Thank you, Sir!
0 Kudos
Message 6 of 6
(3,721 Views)