LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search index of array adding secuence value until arrive to constant value...

Solved!
Go to solution

Hello,

 

I have one arry of RR secuence values (its peak to peak of ECG wave time is seconds). I knows the added value of arrays is the total time of sample data.

 

I would like to separate in diferent graphs the representation of each hour of logged data.

 

I need to get any way to get the index which the number of values added are => 3600s (1h).

 

So i can to know the index of arrays values to get the correct index to graph 1h of values, another index for another hour for another graph,.... so until get the several hourly graph the data can show.

 

I hope you understand me.

 

Best Regards.

0 Kudos
Message 1 of 8
(2,370 Views)

In this example I can get the sum values of array and get the index of array when it is equal or higher than 3600s (1h).

 

But i need get the index of the next hour. So i need test the sum of values with 3600, 7200, 10800,.... until end of data logged.

 

Any help?.

Thanks.

0 Kudos
Message 2 of 8
(2,355 Views)

Here is one way. This is not optimized but should work. The one disadvantage is that the output array contains zeros at the ends of the shorter rows. This is because arrays in LV must be rectangular - all rows must have the same length.

 

The first for loop generates some simulated RR interval data. The middle loop finds the index where the sum crosses 3600 and then resets the sum to zero for the next segment. The third loop splits the data array at the indexes found by the middle loop.

 

It is saved back to LV 2011.

 

Lynn

Message 3 of 8
(2,338 Views)
OK, simple. You have an array of intervals in seconds that you use to generate an array of running totals. Cast that array to integers, perform a modulo 3600 division. The output will be an array of remainders. Find all the elements containing 0, and you're done.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 8
(2,316 Views)

Hello John,

 

thank you, it works. I added the rest of data recorded to plot in the next hour graph.

 

Regards.

0 Kudos
Message 5 of 8
(2,298 Views)

mikeporter escribió:
OK, simple. You have an array of intervals in seconds that you use to generate an array of running totals. Cast that array to integers, perform a modulo 3600 division. The output will be an array of remainders. Find all the elements containing 0, and you're done.

Mike...

Hi Mike,

 

Thank you for you input.

 

Can you elaborate more please, I dont understand when you say ' perfom to 3600 division'. Visual capture is easier to understand better.

Array to integers I suppose you say to use Type cast with type U16.

 

It is interesting to learn diferent point of views...

Regards.

0 Kudos
Message 6 of 8
(2,292 Views)
Solution
Accepted by topic author Fonsi

Modulo division is performed by the Quotient & Remainder function on the Numeric palette.

 

Modulo division.png

It will work with DBL or integer data types and arrays.

 

When I use the method I think Mike intended, the VI sometimes misses an hourly transition. This happens with the simulated data I generate because it is possible for the remainder to be different from zero. For example this can happen if the accumulated sum is 3599.4 s and the next RR interval is 1.3 s. That gives the next sum = 3600.7 s. When converted to integers the sums are 3599 and 3601. The remainders are 3599 and 1 after the modulo division. Neither is exactly equal to zero.

 

I modified this to use DBL and then look for the large negative transition. The minimum value can be up to the largest RR interval in the data. However, there will always be a large transition from close to 3600 to close to zero.

 

Lynn

Message 7 of 8
(2,247 Views)

Hello Lynn,

 

Thank you so much for your time and the explication. Perfect. I got it.

 

Best Regards, Fonsi.

0 Kudos
Message 8 of 8
(2,227 Views)