SHAZAM Community
Ask Your Question

Revision history [back]

Use the READ command to read directly from the file but specify the dimensions using ROWS= and COLS= values. (see page 34 of the v11 manual) where is says:

ROWS=, COLS=

Specifies the number of ROWS and COLumnS when a matrix is being read in. Only one matrix can be read in on a given READ command and if a matrix is being read in, no other variables may be read in on that READ command. SKIPIF commands are not in effect when a matrix is read. The beginning observation on the SAMPLE command is used as the first row number for the matrix. Use the option BEG=1 to ensure that the matrix begins at row 1.

eg. To read 50x50 matrix from file data.txt to matrix X

READ(mydata.txt) X / ROWS=50 COLS=50

Note also that the MATRIX command will read variables in memory too. e.g. to stack variables as matrix columns you might do:

MATRIX example = var1|var2|var3

So for you could also create a new Dataset on the DATA menu of the correct dimensions, paste in the values to the data grid and use the 'Rename Multiple Variables' feature to create names for the columns, then add it to your Workspace. The dataset will automatically be read if Automatic READ is enabled on it and then the MATRIX command could be used. This would be a much more convoluted method than the simple READ command.