LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview and Excel

Hello

I am trying to write the data from my data acquisition system to Excel file. Somehow I am not able to come up with the structure for the operation. My system gets communicates with the equipment and gets data in a set of 60, ie. in 6 arrays (represented as double) and a total of 300 data points. That means my for loop goes through the acquisition process for 5 times.

At the end of the collection of 300 readings, I want to write it to excel file in a column.

Then the user will be asked whether he/she wants to collect another set of 300 readings.

If yes, the next 300 readings will be written in the NEXT column.

There are a couple of nice ActiveX examples on Excel, so I should be able to manage the Excel output part. But I am not able to figure out how to manage the data before writing it to Excel. That is getting the data out of the for loop which gets the 300 readings in 5 steps of 60 readings each. Right now, the 2nd set of 60 readings is overwriting the previously collected 60 readings which is not helping. 😞

Thanks in advance.
0 Kudos
Message 1 of 5
(3,091 Views)
Simply check the size of the array before writing the next column. Just write the next column into the (numberOfColumns+1) column.

As for the Excel thing, you don't have to use any ActiveX stuff if you just want the data in a spreadsheet format. There is a VI called 'Write to Spreadsheet File'. All you have to do is specify the 2D data you want to write, data type, and filename/location. It's pretty painless.
0 Kudos
Message 2 of 5
(3,087 Views)
Maybe I was not clear in my previous post. All double_arrays in the for loop are 10x1 arrays  Following is the current structure:
do
  i=0
  for i < 5
    get double_array 1 
    get double_array 2
    get double_array 3 
    get double_array 4
    get double_array 5
    i++
  write 300 readings as one column
while (user wants to get acquire another set)

The next set acquired in another column in the spreadsheet.

I need help with the highlighted step. At the moment, for i=0 I get 60 reading. Then at i=1, the 60 readings that I get, overwrite the 60 readings at acquired in the previous step. So basically when I exit the FOR loop, I have only the latest acquired 60 readings instead of 300.

Thanks in advance.
0 Kudos
Message 3 of 5
(3,085 Views)
Hiii,
 
             What you can do is i have posted in the vi, that while your i increases to 1 from 0 (mean when first 60 data are filled) then check the max index of the array and make it +1 for you next 60 reading, so the data will be stored in the 61th index in the array, and you also can do insert into array by giving the index as maxindex+1 in the index option of the insert into array. you also can use replace array subset as i shown in the vi, actually insert into array will add the data at the index and if there is any data at that index, insert into will push that data one index higher, and store current data at the given index plaece, instead replace will replace thw data at the current index, and wont increase the index by adding the data. just mange your vi with the way i show, i think it will help you.
 
Thanks,
Nishant
0 Kudos
Message 4 of 5
(3,063 Views)
Hi,
 
Take a look at attached VI. It will do the " write 300 readings as one column" operation you have asked help for.
 
i keep inseting each new array into an existing array
 
Modify it as per your requirement
 
Hope this helps,
 
Regards
Dev
 

Message Edited by devchander on 04-11-2006 01:35 AM

0 Kudos
Message 5 of 5
(3,055 Views)