Array - Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > Array -Commands > !Array Management >

Array - Commands

ARR.Dim Array

Previous Top Next


MiniRobotLanguage (MRL)

 

ARR.Dim Array

Reserves memory for a specified array, setting its size.

 

clip0707

Test Dim/Get Dim.

 

Intention

 

The ARR.Dim Array command is designed to reserve memory for an array.

This is particularly useful for pre-allocating memory for data storage, thereby optimizing performance.

It is not necessary to use the ARR.DIM Commands to reserve Memory for an Array, as the Smart Package Robot will do it automatically

when you try to write to a specified Array-Element.

However increasing an Array "Step by Step" is always slower then reserving the memory at once.

Having said that you can also just access the last Array Element and it will automatically be dimensioned to that size.

If you have dimensioned an ARR.-Array to 100 and you decide that you need 200 Elements, you can just use this command to increase the Number of Elements to 200.
This will not affect the currently stored Elements. To clear an Array, us the ARR.Clr or ARR.Clm - Command.

 

 

 

Syntax

 

ARR.Dim Array|P1|P2

 

 

Parameter Explanation

 

P1 - Array Number: Specifies the array number, ranging from 0 to 32. The Smart Package Robot currently supports a total of 33 arrays.

P2 - Number of Elements: Zero-based. Specifies the number of elements to be reserved for the array. This sets the size of the array.
      If this number is 10, Elements from 0 to 10 will be reserved.

 

Speed in Ticks:

This command uses typically between 400 to 500 Ticks strongly depending on the amount of Memory that is to be reserved.

 

Example

 

'******************************************

'  ARR.Dim Array. - Sample

'******************************************

ARR.Dim Array|1|32

ARR.Get Dim|1|$$DIM

MBX.$$DIM

END.

 

 

 

Remarks

- The command reserves memory for the array, optimizing performance for large data sets.

- Existing elements are preserved when increasing array size; use ARR.Clr or ARR.Clm to clear elements.

- Arrays are automatically dimensioned when accessing elements, but explicit dimensioning is faster.

 

Limitations:

- Array numbers are limited to 0–32, consistent with other MRL array commands.

- ARR.-Arrays are generally 1-dimensional by design. You can make them 2D or 3D using Macros.

- Invalid array numbers or parameters result in no operation.

 

See also:

    ARR.Clm Array

    ARR.Clr Array

    Set Array

    Get Array

    Append Array

    Insert

    Swap

    Delete