Functions > Array and Data Manipulation

This category contains the following functions:

01. append | 02. array | 03. concat | 04. contains |

05. count | 06. extract | 07. first | 08. itemat |

09. last | 10. max | 11. min | 12. part |

13. sort | 14. sortd | 15. reverse | 16. vector |

17. vectorin |

Function append() is used to change an existing named numeric or Boolean variable by appending more values. It has the following form:

append (*var, value_or_array_1, value_or_array_2, ..., value_or_array_n*)

**var:** It is a named variable of type bool or vector (array or number). value_or_array_1, ... value_or_array_n: These are the values to be appended to the variable *var*. If *var* is of type **Boolean** any non-zero values to be appended are converted to 1 (true).

The job of append can be done by using the concat() function and assigning the result back to the first argument passed to concat(). However, append gives better performance if the size of arguments is big.

Creates an array of values, the array can be assigned to a variable for later use.

**Example:**

>> a = array(1,2,3)

>> c = a + 2 (*Adds 2 to every member of 'a' and assigns the resulting array to c*)

Concatenates (joins) supplied array(s) and/or value(s) into a single array. The original parameters are unaffected.

Checks whether certain item is present in some vector or matrix. Its format is:

contains (*var, item*)

Here *var* is an array or matrix and *item* is the value of which the presence is to be checked.

Gets the count of the elements of the given numeric or Boolean array(s) and/or values.

Retrieves valid numeric values from an array (i.e. excludes NaN, Infinity).

Retrieve first element of numeric or Boolean array(s).

Get the element at the given zero-based offset.

**Example**

>> a = array(1,2,3)

>> itemat(a, 1)

>> 2 (*2 is the element at offset 1 in the specified array.*)

Retrieves the last element of numeric or Boolean array(s).

Gets the maximum value(s) from supplied array(s) and/or matrix and/or values.

Gets the minimum value(s) from supplied array(s) and/or matrix and/or values.

Retrieves a part of the given array. It has two forms:

- part(
*array, begin_offset*) - part(
*array, begin_offset, count*)

The first from gets all and the second form gets *count* number of values starting from *begin_offest*.

Returns a sorted (ascending) copy of a single array or a series of values. The original values or array remain unaffected. For sorting in descending order, use sortd function.

Returns a sorted (descending) copy of a single array or a series of values. The original values or array remain unaffected. For sorting in ascending order, use sort function.

The input to reverse() is either a single array or a series of values. The function reverses the given array or values.

A convenient way to define arrays based on fixed increment/decrement) from a starting number up to some other number. The function has the following form:

vector(*initial_value, change, final_value*)

All three parameters can be fractions. *final_value* may or may not be part of the resulting array based on wheather the increments happen to include it in the result. If you want to make sure that the final value is always part of the result, use the **vectorin** function mentioned next.

**Example**

>> a = vector (1,1,10)

>> 1 2 3 4 5 6 7 8 9 10

>> b = vector(-10, 1, 0)

>> -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0

Stands for **vector inclusive**. Works like the vector function except that the final value is always part of the resulting array regardless whether calculations reach it.

1AvM287k9ocUbqp6SPhGLzyGqFx3JZFcSA

Your donations will help keep this free service running.