Number Of Dimensions In An Array - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

3 LET'S CREATE AND EXECUTE A PROGRAM

3.8.1 Number of dimensions in an array

3 - 30
Arrays are not limited to just numeric values. There are types of array that handle
characters as well. In addition, when using numeric type arrays, different types of
numbers can be defined, such as integers, single-precision, and double-precision.
(For details on defining variable types, see the sections for the DEFINT, DEFSNG, and
DEFDBL instructions.)
A$(n)
• • • • • • • • Indicates character array A$.
A%(n) • • • • • • • • Indicates integer array A%.
A!(n)
• • • • • • • • Indicates single-precision array A!.
A#(n)
• • • • • • • • Indicates double-precision array A#.
The dimension of an array refers to the number of indices within the parentheses. The
following example shows one to three dimensional arrays.
One-dimensional
Two-dimensional
...
...
A$(x)
A$(0)
B(0,0)
A$(1)
B(0,1)
A$(2)
B(0,2)
For arrays with two dimensions or more, data can be extracted quickly by combining
meanings.
For example, before specifying the array A(x,y), the following is defined.
X=1
• • • • PLC
X=2
• • • • Factory
automation
controller
X=3
• • • • Robot
The number of PLCs produced to
The target production of robots to
It is possible to define a maximum of 255 dimensions.
REMARK
It is possible to define a maximum of 255 dimensions, but in actuality, the amount of
memory may not be enough when too many dimensions are reserved.
B(x,y)
B(1,0)
B(2,0)
B(1,1)
B(2,1)
B(1,2)
B(2,2)
y=1
• • • • Production
schedule
y=2
• • • • Produced quantity
y=3
• • • • Achievement %
A(1,2)
A(3,1)
Three-dimensional
...
(x,y,z)
C(0,0,0)
C(1,0,0)
C(2,0,0)
C(0,1,0)
C(1,1,0)
C(2,1,0)
C(0,2,0)
C(1,2,0)
C(2,2,0)
C(0,2,1)
C(1,2,1)
C(0,2,2)
C(1,2,2)
Then assign the data as
shown:
This way, data can be extracted only
by matching the values in the
parentheses to the target elements
to reference the target data .
MELSEC-Q
C(2,2,1)
C(2,2,2)
3 - 30

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents