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 9

Trim(a,1)= 1 2 3
7 8 9