11 - 58 11 - 58
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
DIM
Instruction
DIMension
• Specifies the size of a dimension and assigns a memory area necessary for the array.
DIM array variable name (numeric expression [, numeric expression] …) [, array variable
name (numeric expression [, numeric expression] …) ]
array variable name
• • • •
Specify the name of a variable used as an array.
Syntax
numeric expression
• • • •
Specify the size of the array specified by the array
variable name.
Examples
DIM A(2, 2)
• • • •
Indicates a two dimensional numeric value array.
A(0, 0)
A(1, 0)
A(2, 0)
A(0, 1)
A(1, 1)
A(2, 1)
A(0, 2)
A(1, 2)
A(2, 2)
• The DIM instruction specifies the size of an array variable and assigns a memory area
necessary for the array.
• The following arrays can be defined:
A(n)
• • • •
Numeric value array
A%(n)
• • • •
Integer array
A!(n)
• • • •
Single precision array
A#(n)
• • • •
Double precision array
A$(n)
• • • •
Character array
Description
• <numeric expression> may be specified up to 32767. An insufficient memory occurs if too
large memory area is assigned.
• When using an array, a “Subscript out of range” error occurs if the index of the array
variable name is larger than the value of <numeric expression> specified by the DIM
instruction.
• The minimum value of <numeric expression> is 0.
• If an array variable name, which is not specified by the DIM instruction, is used, 10 is
assumed for the minimum value of its index.
In some instructions of AD51H-BASIC, there are some that do not correspond to
the implicit array declarations as shown above.
It is recommended that arrays be used after declaring variables by the DIM instruction.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...