ProductName  

Simultaneously sets both the number of rows and columns of the current matrix object.

Syntax

MatrixObject.Size NumOfRows, NumOfCols

Parameters

NumOfRows
Number of rows of the matrix. Must be an Long integer value greater or equal to 1 and less than or equal to MaxSize property.
NumOfCols
Number of columns of the matrix. Must be an Long integer value greater or equal to 1 and less than or equal to MaxSize property.

Remarks

You can either use Size method or set both Rows and Cols properties, in order to size a matrix.

When a matrix is first sized all its elements are set to 0. Resizing a matrix preserves its previous data.

Error Codes

Error 1301 is returned if NumOfRows parameter is less than 1 or greater than MaxSize property.

Error 1302 is returned if NumOfCols parameter is less than 1 or greater than MaxSize property.

Example

This example demonstrates the use of the Size method.

Private Sub MatrixSize()

Dim A As Matrix
    
    Set A = New Matrix
    A.Size 3, 3
    A.FillRandom
    Debug.Print A.GetString
    
    A.Size 4, 4
    Debug.Print A.GetString
    
End Sub

Output

| 6.000 2.000 8.000 |
| 6.000 5.000 4.000 |
| 9.000 8.000 7.000 |

| 6.000 2.000 8.000 0.000 |
| 6.000 5.000 4.000 0.000 |
| 9.000 8.000 7.000 0.000 |
| 0.000 0.000 0.000 0.000 |

See Also

Cholesky Method | QR method | SVD Method

Applies To: Matrix | CMatrix