Object Reference : Object View and Procedure Reference : Matrix
  
Matrix
 
clearhist
cor
cov
display
displayname
fill
import
Excel Files
Excel Examples
HTML Files
HTML Examples
Text and Binary Files
Text and Binary File Examples (.txt, .csv, etc.)
label
makepcomp
matrix
olepush
pcomp
read
setattr
setcollabels
setformat
setindent
setjust
setrowlabels
setwidth
sheet
stats
write
Matrix (two-dimensional array).
Matrix Declaration
matrix declare matrix object.
There are several ways to create a matrix object. You can enter the matrix keyword (with an optional row and column dimension) followed by a name:
matrix scalarmat
matrix(10,3) results
Alternatively, you can combine a declaration with an assignment statement, in which case the new matrix will be sized accordingly.
Lastly, a number of object procedures create matrices.
Matrix Views
cor correlation matrix by columns.
cov covariance matrix by columns.
display display table, graph, or spool in object window .
label label information for the matrix.
pcomp principal components analysis of the columns in a matrix.
sheet spreadsheet view of the matrix.
stats descriptive statistics by column.
Matrix Graph Views
Graph creation views are discussed in detail in “Graph Creation Command Summary”.
area area graph of the columns in the matrix.
band area band graph.
bar bar graph of each column.
boxplot boxplot of each column.
distplot distribution graph.
dot dot plot graph.
errbar error bar graph view.
hilo high-low(-open-close) chart.
line line graph of each column.
mixed mixed-type graph.
pie pie chart view.
qqplot quantile-quantile graph.
scat scatter diagrams of the columns of the matrix.
scatmat matrix of all pairwise scatter plots.
scatpair scatterplot pairs graph.
seasplot seasonal line graphof the columns of the matrix.
spike spike graph.
xyarea XY area graph.
xybar XY bar graph.
xyline XY line graph.
xypair XY pairs graph.
Matrix Procs
clearhist clear the contents of the history attribute.
displayname set display name.
fill fill the elements of the matrix.
import imports data from a foreign file into the matrix object.
label set label information for the matrix.
makepcomp save the scores from a principal components analysis of the matrix.
olepush push updates to OLE linked objects in open applications .
read (deprecated) import data from disk.
setattr set the value of an object attribute .
setcollabels set the column headers in a matrix object spreadsheet .
setformat set the display format for the matrix spreadsheet.
setindent set the indentation for the matrix spreadsheet.
setjust set the justification for the matrix spreadsheet.
setrowlabels set the row headers in a matrix object spreadsheet.
setwidth set the column width in the matrix spreadsheet.
write export data to disk.
Matrix Data Members
String values
@attr(“arg”) string containing the value of the arg attribute, where the argument is specified as a quoted string.
@collabels string containing the column labels of the matrix.
@description string containing the Matrix object’s description (if available).
@detailedtype string with the object type: “MATRIX”.
@displayname string containing the Matrix object’s display name. If the Matrix has no display name set, the name is returned.
@name string containing the Matrix object’s name.
@remarks string containing the Matrix object’s remarks (if available).
@rowlabels string containing the row labels of the matrix.
@source string containing the Matrix object’s source (if available).
@type string with the object type: “MATRIX”.
@units string containing the Matrix object’s units description (if available).
@updatetime string representation of the time and date at which the Matrix was last updated.
Scalar values
(i,j) (i,j)-th element of the matrix. Simply append “(i, j)” to the matrix name (without a “.”).
@cols number of columns.
@rows number of rows in the matrix.
Matrix values
@col(i) The ith column of the matrix. i may be a vector of integers, in which case multiple columns are returned (as a matrix).
@diag vector containing the diagonal elements of the matrix.
@dropcol(i) Returns the matrix with the ith column removed. i may be a vector of integers, in which case multiple columns are removed.
@droprow(i) Returns the matrix with the ith row removed. i may be a vector of integers, in which case multiple rows are removed.
@row(j) The jth row of the matrix. j may be a vector of integers, in which case multiple rows are returned (as a matrix).
@sub(i,j) The (i,j) element of the matrix. Both i and j may be vectors of integers, in which case multiple elements are returned (as a matrix).
@t transpose of the matrix.
Matrix Examples
The following assignment statements create and initialize matrix objects,
matrix copymat=results
matrix covmat1=eq1.@coefcov
matrix(5,2) count
count.fill 1,2,3,4,5,6,7,8,9,10
as does the equation procedure:
eq1.makecoefcov covmat2
You can declare and initialize a matrix in one command:
matrix(10,30) results=3
matrix(5,5) other=results1
Graphs and covariances may be generated for the columns of the matrix,
copymat.line
copymat.cov
and statistics computed for the rows of a matrix:
matrix rowmat=@transpose(copymat)
rowmat.stats
You can use explicit indices to refer to matrix elements:
scalar diagsum=cov1(1,1)+cov1(2,2)+cov(3,3)