ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving average of 2d array.

Solved!
Go to solution

Hii Friends,

 

Can anyone help me to go through this problem.

 

I have a task wherein, i need to implement the following steps.

 

1) Open a existing spreadsheet file( consisting of p and s columns)

2) Remove peaks of s column by selecting a certain value and then removing the corresponding p column values.

3) I then need to take the moving average of both the p and s columns with interval 10. By this i mean, if i have the following points say 

x      avg(x) with interval 10

1       N/A

2       N/A

3       N/A

4       N/A

5       N/A

6       N/A

7       N/A

8       N/A

9       N/A

10    (average of 1 to 10) = 5.5

11    (average of 2 to 11) = 6.5

12    (average of 3 to 12) =  7.5

.        .

.        .

.        .

 

I have been able to complete the first two steps

I have seen examples of 1d array moving averagin. Since the array is a 2d one, i am slightly confused on how to take the moving average of both the columns at once.

 

can anyone suggest me a way forward.

Attaching the excel and the VI. 

Thanking you.

 

Pa1

 

 

Download All
0 Kudos
Message 1 of 6
(5,581 Views)

If you need to take the Moving average of P and S Columns Separately, Index this columns into two 1D array and do a running average by taking the array subset where the offset should start from 0 to N and the Length remains same Assume 10

 

Hope this will help you!

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 6
(5,535 Views)

Thanks PalaniveIT for your reply.. can you show me a screenshot of how to index the columns into 2 different arrays..

0 Kudos
Message 3 of 6
(5,533 Views)

I gave a try..is it the right way to do array indexing?

0 Kudos
Message 4 of 6
(5,523 Views)
Solution
Accepted by topic author Pa1_korea

RunningAverage.png

 

 

If you are acquiring data continuously instead of Loop can be eliminated the indexing can be Maintained in Acquiring Loop or using shift register

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 5 of 6
(5,522 Views)
Solution
Accepted by topic author Pa1_korea

HI,

 

a solution based on ready-to-use functions in LabVIEW:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(5,510 Views)