LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loading and analyzing spreadsheet taking forever

Hello, 

    I have a spreadsheet file created from another VI which is an 10(r) x 1028(c) array.  I want to load the file and average each individual column to get a new 1 x 1028 array.  My VI is built in a loop in which it loads the array, extracts the column corresponding to the loop number, averages it, and then appends it to a new spreadsheet.

 

I am finding this method to take forever to do.  It doesn't seem like loading an array, picking a column and doing an average to take as long as it does.

 

My one thought is that the program currently loads the spreadsheet each loop, which could be an issue for time.  Does anyone have a faster method for this?

0 Kudos
Message 1 of 3
(2,041 Views)

What is your meaning of "Spreadsheet"? Are you talking about plain ASCII file generated by "write to spreadsheet file" or are you talking about excel, for example.

 

What are your units for "forever" (milliseconds, seconds, hours, days?) 😄 Does it ever finish?

 

Since we don't see your code, we cannot tell why it is slow, so please attach it. I would thing it should be very fast. All you need is to read the file once, autoindex over colums (i.e. transpose first), take the mean, and autoindex back to a 1D array, then writing the 1D array back to a single column file.

 

0 Kudos
Message 2 of 3
(2,040 Views)

To average each column would be 1028 file open and closes.  That's probably what's slowing you down.  Open the file once before your loop and close it after.

 

Edit: Whoops!  I didn't see Altenbach's .png.  Anyway, what he said.Smiley Happy

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 3 of 3
(2,029 Views)