T O P I C R E V I E W |
couturier |
Posted - 02/08/2011 : 03:32:01 AM Origin Ver. 8.5 SR1 Operating System: XP Pro SP3
Does anyone know a fast way to compute the center of gravity of a matrix with Labtalk ?
For now, I'm doing it the hard way: Sum(Xi.Zi)/Sum(Zi) and Sum(Yi.Zi)/Sum(Zi) but it is something I want to perform MANY times and looping through rows and cols is way too slow.
Thanks |
2 L A T E S T R E P L I E S (Newest First) |
couturier |
Posted - 02/18/2011 : 5:32:43 PM quote: You can use X-Function mstats
Using Xf is a no-go (way too slow, because of overhead).
Anyway, if anyone is interested, I've found that the sum function works with matrix, result being stored in sum.total |
Sam Fang |
Posted - 02/09/2011 : 04:54:33 AM You can use X-Function mstats to calculate the sum of a matrix.
To calculate the CG of a matrix, you can create two additional matrices for Xi*Zi and Yi*Zi first using Set Matrix Values.
Sam OriginLab Technical Services |