Can I access excel math functions from flex action script via vbscript injection?

We're going to display some math data in a Flex GUI graph. We need to make a graph for two datasets.

cross-correlation of both autocorrelation of each and correlation coefficient

It looks like Flex doesn't support scientific formula like cross-correlation, autocorrelation, and collaborative collaboration. Please correct me if I am wrong, or if there are reasonable alternatives at the moment.

While looking for alternatives, I came across this article on actionscript.org [- not allowed -]

and I am currently trying to figure out if I can call excel formulas from ActionScript. It looks like there might be some difficulty in passing data between flex and vbscript. Will it be right?

This is for POC and therefore we are looking for a quick hack.

+1


a source to share


3 answers


It's probably too late, but, well ... I got bored :)






private function correlationCoeff(X:Array, Y:Array):Number
{
    //correlation coeff between two random variables X and Y is defined as :
    //correlation(X,Y) = Covar(X,Y)/(sqrt(Var(X)) * sqrt(Var(Y)))
    //
    //Var(X) = Covar(X,X);
    //Covar(X,Y) = E((X-xm)(Y-ym)); where xm, ym are the population means.
    return sampleCovar(X, Y)/Math.sqrt(sampleCovar(X, X) * sampleCovar(Y, Y));
}
      





private function sampleCovar (X: Array, Y: Array): Number {// Sample covariance is Sum ((X-xm) (Y-ym)) / n-1 // where n is the sample size and xm & ym are sample means. // I'll assume that X and Y are the same size ... var total: Number = 0; var xm: Number = sampleMean (X); var ym: Number = (X == Y)? xm: sampleMean (Y); for (var i: int = 0; i

private function sampleMean (X: Array): Number {// Sample mean = Sum (X) / (sample size) var total: Number = 0; for each (var x: Number in X) total + = x; return total / X.length; }

I preferred that you were working with discrete random variables rather than doing something funky with signal processing. Be aware that sampleCovar will not return the same as COVAR in Excel because Excel uses a biased estimate (i.e. it divides by n, not (n-1)), but this is overridden when calculating the coefficient correlation.

+1


a source


I have never used VBScript, but I know that you can access JavaScript from AS3 and vice versa using a class ExternalInterface

in AS3. And as far as I know, you can also access VB functionality embedded in web pages from JavaScript. This way, it shouldn't be too hard to call VB functions from Flash.



0


a source


Using ActionScript, you can write your own version of COREL for calculation. It will be much easier than trying to contact Excel. Of course, there is no direct way to communicate with Excel from within a Flex application.

0


a source







All Articles