Mitsubishi Electric CR750-Q Instruction Manual page 235

Cr750/cr751/cr760 series
Hide thumbs Also See for CR750-Q:
Table of Contents

Advertisement

Dim (Dim)
[Function]
Declares the quantity of elements in the array variable. (Arrays up to the third dimension are possible.)
[Format]
Dim[]<Variable name> (<Eelement Value> [, <Eelement Value> [, <Eelement Value>]])
[, <Variable name> (<Eelement Value> [, <Eelement Value>[, <Eelement Value>]])]...
[Terminology]
<Variable name>
<Eelement Value>
[Reference Program]
1 Dim PDATA(10)
2 Dim MDATA#(5)
3 Dim M1%(6)
4 Dim M2!(4)
5 Dim CMOJI(7)
6 Dim MD6(2,3), PD1(5,5)
[Explanation]
(1) A one-dimensional, two-dimensional or three-dimensional array can be used.
(2) In the case of numeric variables, it is possible to use integer, single-precision real and double-precision
real variables differently by adding a symbol that indicates the type of each variable to the variable
name. If the variable type is omitted, a single-precision real variable will be assumed.
Dim MABC(10) ' Define the single-precision real number type array variable MABC having ten ele-
(3) Eelement number start from 1 when actually referencing array variables. For PDATA on step 1 of the
statement example, the element number will be 1 to 10.
(4) <Eelement Value> can be described with numeric constants from 1 to 999. It is not allowed to use a
numerical value operation expression.
If the number of elements is specified using a real number, an integer with rounded decimal part will be
assumed. Depending on the system memory's free space, arrays may not be allocated for the number
of specified elements. In this case, an error will occur when lines are registered.
(5) If an element number larger than the number of defined elements is specified, an error will occur at the
time of execution.
(6) At the point when array variables are defined, variable values are indeterminate.
(7) To use array variables, it is necessary to define them using the Dim command.
(8) The arrays defined by the Dim command are valid only in the program where they are defined. To use
these arrays by a sub program called by the CallP command, it is necessary to define them again.
(9) Array variables can be used similar to normal variables. However, note that variables of which variable
names and/or the number of characters for specifying element numbers exceed eight characters can-
not be used on the monitor variable screen and position edit screen of the teaching pendant.
(10) If a variable name whose second character is underlined "_" is registered in a user program, a user
defined external variable (a variable common among programs) will be assumed..
Refer to
Page 145, "4.4.24 User-defined external variables"
Describe the name of the array variable.
Describe in terms of constants, the number of elements in an array variable.
' Define the position array variable PDATA having ten elements.
' Define double-precision type array variable MDATA# having the five
elements.
' Define integer-type array variable M1% having the six elements.
' Define single-precision real number type array variable M2! having the
four elements.
' Define the character-string type variable CMOJI having the seven ele-
ments.
' Define the 2-dimensional single precision real number type array vari-
able MDATA having the element of 2x3.
' Define the 2-dimensional position array variable PD 1 having the ele-
ment of 5x5.
ments.
for details.
Detailed explanation of command words 4-215
4MELFA-BASIC V

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cr750Cr751-qCr751-dCr760-dCr760-qCr750-d

Table of Contents