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: 

writing data to excel sheet

Hi,
 
I have a few questions when writing to an Excel sheet, please refer to the VI attached.
 
Question1. In the present VI the data that gets stored from the second VI into the excel sheet is offset by 5 rows, how do i get this to start from the same row as the data written in the first for loop.
 
Question2. How can i reverse this data in loop 2 such that it gets written as 5 4 3 2 1 and not 1 2 3 4 5.
 
Any ideas would be much appreciated. I want the data to be wirtten directly to the file as soon as it is read to prevent loss of and data due to software crash.
I guess the answer to Question 2 would be that i have to wait for the entire array to be read before reversing it, i can work with that but what about the first question.
 
Thanks
GM 
0 Kudos
Message 1 of 5
(2,343 Views)
Sorry forgot to attach VI
0 Kudos
Message 2 of 5
(2,339 Views)

Damn sorry i found another mistake

Question1. In the present VI the data that gets stored from the second FOR LOOP into the excel sheet is offset by 5 rows, how do i get this to start from the same row as the data written in the first for loop

0 Kudos
Message 3 of 5
(2,338 Views)
The Tabs being fed to the Write Chars to File VI in the second loop are what is causing the offset. A Tab causes the spreadsheet to move to the next cell in the row. What purpose do the Tabs serve?

As for reversing the data you would need to collect all the data for the row and reverse it before writing to the file. Since you indicated that you are writing to file as the data is collected to prevent data loss, you have to decide whether to risk the loss of a whole row of data or to post-process the file to reverse the data after the collection is completed.

The Write Characters to File and Write to Spreadsheet File VIs open/write/close the file internally. This can slow operations in a loop. Depending on the data collection rates and the risk of data loss, you may want to consider whether the frequent opening and closing, especially in the second loop, is apprpriate.

Lynn
0 Kudos
Message 4 of 5
(2,326 Views)

Hi,

Thank you for your response, i purposely added the Tabs so that i can be offset by two columns, but i cannot start from row 0. I guess the only way to do this is to collect all the data and arrange it accordingly.

 

GM

0 Kudos
Message 5 of 5
(2,322 Views)