01-10-2012 05:57 PM
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?
01-10-2012 06:03 PM - edited 01-10-2012 06:19 PM
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.
01-10-2012 06:21 PM - edited 01-10-2012 06:23 PM
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.