03-26-2009 11:27 AM
Hello,
I am new to labview and I am having difficulty creating an array and writing it to a spread sheet. I have a for loop that generates 3 data values every interation. I would like to write these values to a 2d spread sheet with three colums. I attached a sample VI, but I dont know what is wrong. Thanks.
03-26-2009 11:45 AM - edited 03-26-2009 11:47 AM
Try something like this:
(Your main problem is that you start with an empty array and try to insert at column 1. This place does not exists. Start with index zero.)
03-26-2009 11:48 AM - edited 03-26-2009 11:51 AM
Heres a quick way to do it:
The cool thing about For loops is that they will auto-index.
So when you pass each of the 3 values out of the array, they will each build a 1-D array.
Each of these will act as a column, so if you use a 'Build Array' function, it will combine all 3 1D arrays into a 2D array.
Then use a 'Write to Spreadsheet File' function
Edit: darn, too slow
03-26-2009 12:34 PM
Cory,
Your code would generate three rows instead of three columns. You would need to transpose for writing. This is the reason I was using "build array" inside the FOR loop.
03-26-2009 12:39 PM
altenbach wrote:Cory,
Your code would generate three rows instead of three columns. You would need to transpose for writing. This is the reason I was using "build array" inside the FOR loop.
Oh, you're right, I didnt check which way the array was oriented. Oh well, nothing a quick 'Transpose Array' cant fix.
03-26-2009 01:01 PM