From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I extract set of columns from multiple spreadsheet files?

So I have 10 CSV files in a directory. In each file, first column is voltages and second column is velocities. I only need the second column from each. Half of them are also repeats of each other (to eliminate experimental error) so I will need to average them. At the end, what I am after is a 2D array of doubles (5 by N). Finally, sample size (N) is different for different files.

Attached is what I have got so far. Could anyone inform me as to how I would separate out that awkward array into my desired format?

 

0 Kudos
Message 1 of 2
(2,363 Views)

First, get rid of the stray wires that go to the edge of the For Loop and never get used.  Also use Block diagram cleanup to get rid of extra wire bends.

 

Put the Index Array Inside of your For Loop, you want column 2 of each file.  The while loop you have does nothing except spin as fast as possible and show an entire 2-D array of whatever page you select on the graph.

 

One problem you have is since N is different from each file, you can't really create a 2-D array that contains every second column since the shorter ones will get 0's added to the end to match the length of the longer one.  You'll probably need to do the processing of each 1-D array that represents the second column of each file in the loop.  But I'm not really understanding what it is you are wanting to average (each column into 1 value?,  each element with the corresponding element in another file's 2nd column?) or what you mean by some files being repeats to be able to tell you better what you want to do.

Message 2 of 2
(2,343 Views)