06-21-2021 07:23 AM
I am working with a Anemometer and was reading the data from it through LabView. I have the program completely configured but i am having problems with the time instants at which a measurement is made from my device and stored in a excel sheet. The current data recorded on excel sheet is random and there are 4 measurements in a second and sometimes there are no measurements for 2 or 3 seconds. I want to configure my device so that a reading is noted in the excel only at one second intervals. I tried using 'elapsed time' module and set it 1 second before giving the signal to 'write to file' but for that no measurements were recorded in the excel file.
06-21-2021 07:52 AM - edited 06-21-2021 08:00 AM
Hi Ahraar,
@Ahraar wrote:
The current data recorded on excel sheet is random and there are 4 measurements in a second and sometimes there are no measurements for 2 or 3 seconds. I want to configure my device so that a reading is noted in the excel only at one second intervals.
A big problem: you are using the WriteMeasurementFile ExpressVI to write to a XLSX file! This will take longer than you might expect!
A better solution would be to write to a simple CSV file, which is opened once before the loop and closed once after the loop…
When you want to write to the file once per second you might write each 4th iteration of the loop: use Q&R (quotient&remainder) on the loop counter to check for each 4th iteration and place the FileWrite function inside a case structure…
Btw. cleaning up the block diagram will help you and others to understand the code better/easier:

06-21-2021 08:41 AM
How do i save it to CSV file. In the properties of my 'Write to Measurement file' module, i can select .tdms , .xlsx , .lvm options for file formats. Can you also please describe something about how to use the Q and R inside the case structure to record the measurements every one second
06-21-2021 08:49 AM
Hi Ahraar,
@Ahraar wrote:
How do i save it to CSV file. In the properties of my 'Write to Measurement file' module, i can select .tdms , .xlsx , .lvm options for file formats.
Use WriteTextFile with FileOpen/-Close before/after the loop. No need for ExpressVIs!
@Ahraar wrote:
Can you also please describe something about how to use the Q and R inside the case structure to record the measurements every one second
Do you know about modulo division? "i modulo 4 == 0" every 4th iteration of the loop…
(Read the help for the Quotient&Remainder function!)
06-21-2021 09:29 AM
I don't know how to implement the file open and file close loops. What module do i need to wire my signal then to store the data to a file? I can configure express vi.
Can you maybe provide a link wherein i can learn about this, maybe a labview course.
06-21-2021 09:40 AM
Hi Ahrar,
@Ahraar wrote:Can you maybe provide a link wherein i can learn about this, maybe a labview course.
There are"Training resources" at the top of the LabVIEW board.
And there are lots of examples in the LabVIEW example library!