Matrix.Clear
------------

Clears the matrix.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Matrix](component_Matrix.md) | [9.2](newinversion92.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Matrix.Clear"; MatrixRef ) 

**MBS**( **"Matrix.Clear"** /\* Clears the matrix. \*/  
**$MatrixRef**) /\* The matrix reference number. e.g. $matrix \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| MatrixRef | The matrix reference number. | $matrix |

### Result

Returns OK or error.

### Description

Clears the matrix.  
Removes all values from it and sets size to 0/0.  
### Examples

Clear and check:

 Set Variable \[ $r ; Value: MBS ("Matrix.Clear"; $matrix ) \]   
\# After this step the width and height of the matrix are 0   
Show Custom Dialog \[ "Matrix Height" ; MBS ("[Matrix.Height](MatrixHeight.md)";$matrix ) &amp;"="&amp; MBS ("[Matrix.Width](MatrixWidth.md)";$matrix ) \]  
### See also

- [Matrix.ClearValues](MatrixClearValues.md)
- [Matrix.Clone](MatrixClone.md)
- [Matrix.Height](MatrixHeight.md)
- [Matrix.Width](MatrixWidth.md)

This function checks for a license.

Created 8th April 2019 , last changed 25th February 2026

  
[Matrix.CSVSplit](MatrixCSVSplit.md) - [Matrix.ClearValues](MatrixClearValues.md)

[HTML Version](MatrixClear.shtml)