Trim function
Removes invalid values from a list or table
Description
The Trim function removes invalid elements or elements that do not contain a value from a list or table. The function can be used, for example, if a column is to be calculated from an imported Excel table in which texts (headings, comments) are also included.
Invalid elements
Text strings containing a calculable value are converted into a number. If the transformation fails, it will be removed from the list. In addition, the values are removed infinitely and undefined as invalid.
Tables
For tables, an additional parameter can be used to set how the invalid elements should be handled.
- A zero specifies that an invalid element is replaced by a zero
- A one specifies that a line containing an invalid element should be deleted
Syntax
Trim (list)
Trim (table)
Trim (table, remRow)
Examples
Trim ([1,2,"Hi",4, 5,"6",7]) =1 2 4 5 6 7
a=[1,2,3;4,5,∞;7,8,9]
Trim(a,0)= 1 2 3
4 5 0
7 8 9Trim(a,1)= 1 2 3
7 8 9
Data field based functions
ClrRect | Deletes a rectangular area |
Clip | Limits values of a data field |
Count | Returns number of elements |
Diff | Difference values of elements |
Dim | Number of dimensions of tables |
Flat | Joins rows of a table |
GetAt | Value of a specified position |
GetRect | Returns the specified area |
Insert | Inserts new elements |
Join | Join fields together |
New | Generates a new list |
Pick | Get selected items from a list |
Remove | Removes items from a list |
Reverse | Inverts the order in a list |
Scale | Converts values to a new scale |
SetAt | Sets a value at a position |
Split | Splits a list into sublists |
Sum | Returns the sum of all elements |
Text | Generates a text list |
Trim | Removes invalid values |