01-05-2011 05:45 PM
Hello Everyone,
Can anyone please tell me how to read one column out of many columns in a .csv file using normal LV techniques?
I did see many of examples where they had toolkits, but can anyone suggest me some codes without those toolkits?
I have 5 columns; 1st is time column and the rest contains numbers.
ANy help is appreciated
01-05-2011 05:55 PM - edited 01-05-2011 05:57 PM
01-05-2011 05:55 PM
Read all columns, then use "index array" to get the desired column.
Column values are not adjacent in the file, so trying to "surgically" read columns is impossible. You would need to read every single byte of the file anyway in order to see where the commas are and thus where the column values start.
01-05-2011 07:37 PM
altenbach, thanks a lot for the reply, but i have a column full of numbers, also, i want to display one column in 1 array, next column in 2nd array and so on... how can we do it?? The values are 'tab' seperated ... if i am not clear, please let me know...
once again, thanks a lot
01-05-2011 07:41 PM - edited 01-05-2011 07:41 PM
As I said, you read the entire file into a 2D array, then use "index array" to slice out any column you like. Where are you getting stuck?
01-05-2011 08:23 PM
i could get only 1 column to read and save into an array... i cannot get the next column to read, i dunno how to create a multi-dimensional
array which can save up ALL the column data, and then later on, i can index the arrays like you mentioned...
01-05-2011 08:32 PM
01-06-2011 09:18 AM
altenbach, i still have 5 columns, its only that i want to read 1 column, save it in an array, and display that column on a waveform chart...
similarly do this for all the remaining columns... well, i got the code to read one column at a time, by converting .xlsx file to .txt with tab limited option selected (while saving .xlsx to .txt)
next thing i would like to do is:
1. column 1 in excel file is a time stamp. The time stamp is in hr:min:sec format.
2. column 2 in excel file is a date stamp in the format DD:MM:YY
how can i make LV read the time and the Date stamps from an excel file...
I will post my code soon, its on a laptop to which i dnt have internet access.
01-06-2011 09:44 AM
Your code should be reading the entire file at once with the Read From Spreadsheet File function. Set it to read strings. This returns a 2D array which you can easily index.
01-06-2011 04:25 PM
You should be able to do this in the following manner:
Best of luck!
Lynn