basic.mat

Statement/BASIC Program, Releases: AP and R83

Assigns data to a dimensioned array.

Syntax

mat array.variable = expression {mat} array.variable1 = {mat} array.variable2

Description

assigns data to each element of a dimensioned array variable to a specific value in one operation.

Array variables must be defined in a 'dim', 'common', or 'file' statement.

{mat} array.variable1 = {mat} array.variable2

Copies one array into another. The number of elements in 'array.variable1' must be less than or equal to the number of elements in 'array.variable2'. It is possible to assign a two-dimensional array to a single-dimensional array, and vice-versa.

Example

mat customer.item = ''

This sets every array element of 'customer.item' to null.

mat customer.item.history = mat customer.item

This sets every array entry of 'customer.item.history' to its
corresponding entry in 'customer.item'.

dim a(10,2)
dim b(20)
mat b = 1
b(3) = 2
mat a = mat b

This example assigns all of the element in the two dimensional array,
'a' into the one dimensional array, 'b'. The rows are
'filled' before the columns, therefore a(2,1) = 2.

See Also

Command Name Type Description
basic.assignment Definition Assigns value to variable.
basic.statements Definition Definition of statements and functions.
basic.dim Statement Declares a dimensioned array.
basic.matread Statement Reads item into dimensioned array.
basic.matwrite Statement Writes dimensioned array to file.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.