The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Cumulative average
vinothrajan
Member Posts: 3 Contributor I
Hi ..
Need to calculate cumulative average,able to do cumulative sum. But want to calculate cumulative average like below
C1 C2 C3
1 1 1
2 3 1.5
3 6 2
here C1 - real value,c2 cumulative sum,c3 cumulative average-which need to calculate.
thanks in advance.
Need to calculate cumulative average,able to do cumulative sum. But want to calculate cumulative average like below
C1 C2 C3
1 1 1
2 3 1.5
3 6 2
here C1 - real value,c2 cumulative sum,c3 cumulative average-which need to calculate.
thanks in advance.
0
Answers
Hi,
so if I get you right, you have already C1 and C2 as an example set. In this case you can simply use "generate attributes" to calculate C3.
In case you don't have C2 you can use loop operator to generate is as well.
Cheers
Sachs
input:
?
?
77841
11992369
782045.444
4690112.111
176680.111
--------------------------
output:
?
?
77841
6035105 <== ((77841+11992369)/2)
4284085.148 <== ((77841+11992369+782045.444)/3)
4385591.88875 <== ((77841+11992369+782045.444+4690112.111)/4)
176680.111
It shows how to loop (iterate) through an attribute (column) and write the difference of two proximate data values to a new attribute.
As this is quite similar to your question and provides all the tools (macros, loop, etc.) you need I hope that you can easily adapt it.
In case you still have troubles go as far as you can get and post your code here.
Cheers
Sachs