LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to open and read many files from a directory and store contents in 2D array?

I want to make a VI that opens and reads the data from various files contained in a directory (200 files each with 2 columns) and store these in a single 2D array. For file number 1 I want to store the data from both columns in the 2D array, but for files 2 to 200 I only want to store the second column of each file. Can someone please help?
0 Kudos
Message 1 of 5
(2,788 Views)
Hi,

1) Use "File I/O / Advanced File Functions / List Directory". This VI will get you all files that found in folder.
2) In "FOR" loop with auto-indexing read each file by "Read From Spreadsheet File.vi". This vi will get you array of data that founds in file.
3) Build your array.
Message 2 of 5
(2,788 Views)
Hi Nadav,
Thanks for your help. I have followed your instructions but i cannot get it to work. I used the LIST DIRECTORY to list the files in the directory - that works. However, how do I read each of the 200 files using READ FROM SPREADSHEET FILE without me having to manually select each of the 200 files? So, if I use LIST DIRECTORY to list all 200 files in an array, how do I get each of these to open and store the data in a 2D array? Here is what I have done (File called read_files.VI) Could you please help me? Thank you very much in advance.
0 Kudos
Message 3 of 5
(2,788 Views)
Hi RVR,

have a look to your "manipulated" vi - maybe it is close to your solution.............

regards
wha
0 Kudos
Message 4 of 5
(2,788 Views)
hi
I am having similar problems, do you have this vi for version 6i....thanks
0 Kudos
Message 5 of 5
(2,788 Views)