next up previous contents
Next: Data reorganization Up: Matrices Previous: The matrix structure

Frame - Matrix commands

    

d2m Convert a data frame into the framed matrix form
-d <data> data frame to convert
-mout <matr> name of the destination framed matrix
-dim <n> <d1>...<dn> n is the number of dimensions and d? is the length of each dimension
f2m Convert a data field to the matrix form
-f <field> data field to convert
-mout <matr> name of the destination framed matrix (a matrix containing only one line)
m2d Convert a matrix to a data frame
-m <matr> framed matrix to convert
-dout <data> destination data frame
shape Change the shape of a matrix
-m <matr> input framed matrix
-mout <matr> name of the destination framed matrix
-dim <n> <d1>...<dn> n is the number of dimensions and d? is the length of each dimension

These commands are used to manipulate the data structures in the NDA, especially matrices that have been put into a frame. The data frame for d2m can contain several fields, each of these fields is converted into a matrix structure. The command f2m converts only one field into a matrix. The default form of one line containing all field items is used. The command m2d converts a matrix into a normal data frame, which can be saved or used with other NDA commands. The command shape is used for changing the dimensions of matrices. The matrices are actually data frames with fields defined as matrix structures.

REMARKS! Matrices cannot be saved directly. Instead, they must first be converted into normal data frames, which can be saved the normal way.
Matrices need to be enclosed within a frame before converting them (m2d). To select a matrix into a frame, use select <frame> -n <matrix>. To print this kind of matrix, use print <frame>.<matrix>.

Example (ex2.3): This example shows how these commands can be used for changing the data format inside the NDA.

NDA> load sin.dat
# Change data fields into 2x10 matrices (mat.x and mat.y) 
NDA> d2m -d sin -mout mat -dim 2 2 10
# Change field sin.x into a 1x20 matrix.
NDA> f2m -f sin.x -mout matx
# Create a new matrix from "mat" with different shape
NDA> shape -m matx -mout matr -dim 2 4 5
# Create a new data frame from the matrix 
NDA> m2d -m matr -dout data
# Save the new data frame 
NDA> save data


next up previous contents
Next: Data reorganization Up: Matrices Previous: The matrix structure

Anssi Lensu
Thu May 17 15:00:44 EET DST 2001