Accessing the Matrix Library via the MatrixObject

STATISTICA contains a MatrixObject object that encapsulates the Matrix library, allowing you to take full advantage of STATISTICA's rich collection of matrix functions without having to include the STB library explicitly. To use this method, simply refer to the MatrixObject directly (as you would any other variable) and call its member functions with the "." operator. The following example demonstrates how to perform some basic matrix operations using the MatrixObject.

Dim DataArray() As Double
Dim
spr As Spreadsheet
'open the Cars dataset

Set
spr = Spreadsheets.Open(Path & "\Examples\Datasets\Cars.sta",False)
'display it in a new spreadsheet

MatrixObject
.MatrixDisplay(spr.Data,"Cars Dataset")
'load the spreadsheet into a matrix

ReDim
DataArray(spr.NumberOfCases,spr.NumberOfVariables)
MatrixObject
.MatrixDuplicate(spr.Data,DataArray())
MatrixObject
.MatrixDisplay(DataArray(),"Cars Dataset via a Matrix")
spr.Close(False)

Note that if you are calling the MatrixObject in an environment other than STATISTICA (e.g., MS Excel), then you must place the STATISTICA Application object pointer prefix in front of the MatrixObject.  For example:

Statistica.MatrixObject.MatrixDisplay(DataArray(),"Cars Dataset via a Matrix")