LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data merging and logging from for loops

Solved!
Go to solution

I have data that's being logged into 2 loops in separate xlsx files. I want to combined the data of these 2 files into one file with the colums next to each other. One file has the data from an GPS receiver with (longitude, latitude and altitude) and the other has the average power of an power sensor ? is there anyway to do this?

0 Kudos
Message 1 of 14
(3,393 Views)

I have data that's being logged into 2 loops in separate xlsx files. I want to combined the data of these 2 files into one file with the colums next to each other. One file has the data from an GPS receiver with (longitude, latitude and altitude) and the other has the average power of an power sensor ? is there anyway to do this?

0 Kudos
Message 2 of 14
(3,376 Views)

Hi,

 

Firstly, Your Diagram is very overloaded. You should learn more about dataflow paradigm in LabVIEW.

However to solve your problem you should use elements of Array palette (built array for example)  and low level VIs of palette File I/O to resolve your problem.

 

let me know if you have others questions.

 

Kudos are welcome!   Smiley Happy

Message 3 of 14
(3,367 Views)

Why so many loops?  Can you combine into a single loop and then you only have to write to the file in 1 place?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 14
(3,352 Views)

Hello the data is coming from 2 separate sensors, that why i need two separate loops

0 Kudos
Message 5 of 14
(3,341 Views)

Hi shivik,

 

Hello the data is coming from 2 separate sensors, that why i need two separate loops

And what's the reason for this statement?

There might be reason, but surely not "there are 2 separate sensors"…

 

Hint: Ever heard of producer-consumer scheme?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 14
(3,337 Views)

Hi Shivik,

 

It would be best to use a produce consumer pattern to save all the data within 1 while loop.

http://www.ni.com/white-paper/3023/en/

 

Here you can format your data in 1 go.

 

NI also does not recommend the usage of the write to measurement file express vi in a loop as this will affect performance.

What you can do is look at TDMS files as they will give you a more scaleble approach. Use these with a normal file I/O chain to greatly reduce computer resource usage.

http://www.ni.com/white-paper/3727/en/

 

Kind regards,

Natan Biesmans

Message 7 of 14
(3,323 Views)

Hello thanks for your suggestions. But i think the producer/consumer scheme will not work. I have 2 sensors with prodcue data at differernt rates. one is a power sensors with (8Msamples/second) the other is a gps sensor with 1 sample per second.

 

I want to write the data of both sensors simultaneously to one file. with 3 coulms the GPS sensor data(longitude, latitude and altitude) and 1 column with the power sensor data(average power). 

 

Since I won't use this data during ""storage process" , the producer/consumer look will be useful in this case

0 Kudos
Message 8 of 14
(3,292 Views)

Hi shivik,

 

But i think the producer/consumer scheme will not work.

Why not?

 

I have 2 sensors with prodcue data at differernt rates. one is a power sensors with (8Msamples/second) the other is a gps sensor with 1 sample per second.

So you could read both sensor data in one loop, one with 8MS/s and the other with just 1S/s. What's the problem?

 (I might still use two loops for those two sensors, writing the "fast" data in a queue and the "slow" one into a notifier…)

 

I want to write the data of both sensors simultaneously to one file. with 3 coulms the GPS sensor data(longitude, latitude and altitude) and 1 column with the power sensor data(average power). 

So you want to average this power data down to 1S/s? Or do you want to resample the power data to something in the order of 10kS/s?

Anyway: keep the GPS data in a notifier to always read the latest sample. Combine it with your power data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 14
(3,281 Views)

Hi Shivik,

 

I created a quick example that shows you how to use the producer consumer loops.

 

This is not the most optimal solution but will be enough to get you started.

 

Kind regards,

Natan Biesmans

Message 10 of 14
(3,264 Views)