ArrayTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Low-level Manipulation : Matrices, Vectors, and Arrays : ArrayTools : ArrayTools/Remove

ArrayTools

  

Remove

  

remove entries and shrink an Array

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Remove( A, i);

Remove( A, a..b);

Parameters

A

-

1-D Array or Vector

i, a, b

-

integer index

Description

• 

The Remove command deletes the entries at index i, or index range a..b.  After this operation, upperbound(A) will be smaller by the number of elements deleted.  

• 

If A is an array or vector with an index range starting at zero or higher, then negative indexing can be used to specify the index to remove.  For example, Remove(A,-1), will remove the last element, and Remove(A,-2..-1) will remove the last two elements.

• 

This operation works in-place and will cause all references to A to be modified accordingly.

• 

The Remove command only works on 1-D Arrays and Vectors with rectangular dense storage and no indexing function.  

• 

This function is part of the ArrayTools package, so it can be used in the short form Remove(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[Remove](..).

Examples

withArrayTools:

AArray11,22,33,44,55

A1122334455

(1)

Remove A[3] and shrink:

RemoveA,3

11224455

(2)

A is permanently changed:

A

11224455

(3)

upperboundA

4

(4)

ArrayDimsA

1..4

(5)

numelemsA

4

(6)

Remove a range of elements

RemoveA,1..2

4455

(7)

Remove the last element

RemoveA,1

44

(8)

Add some elements back

A255

A24455

(9)

A366

A3445566

(10)

A

445566

(11)

Remove the last two elements

RemoveA,2..1

44

(12)

Compatibility

• 

The ArrayTools[Remove] command was introduced in Maple 2019.

• 

For more information on Maple 2019 changes, see Updates in Maple 2019.

See Also

ArrayDims

ArrayTools[Size]

lowerbound

numelems

rtable_indexing

upperbound