ProductName  

Returns a formatted string displaying all matrix elements.

Syntax

MatrixObject.GetString(NumDecimalPlaces, EndOfLineChars)

Return Value

Returns a String formatted as table containing all matrix elements.

Parameters

NumDecimalPlaces
Optional. Number of decimal places to which the formatted element values will be rounded. Default value is 3.
EndOfLineChars
Optional. Default value is vbCrLf = Chr$(13)+Chr$(10). Use this parameter to control the characters you want to print after end of a line (a matrix row).

Remarks

This Method can be used to show matrix elements in a debug window or textbox, or used to print a matrix to a form or printer.

If matrix the has not been sized, a string containing  "| Empty |"  will be returned.

Example

The following code example demonstrates the use of the GetString Method. One real and one complex matrix are created, sized, and then filled with random values. Then GetString is used to show the matrices in the debug window.

Private Sub MatrixGetString()

Dim A As Matrix, B As CMatrix

Set A = New Matrix
A.Size 6, 6
A.FillRandom 1, 100, 1
Debug.Print A.GetString(2)

Set B = New CMatrix
B.Size 4, 3
B.FillRandom -1, 1, 5
Debug.Print B.GetString(4)

End Sub

Output

| 56.80 20.10 81.10 58.90 48.50 35.70 |
| 89.70 82.50 74.90 18.20 86.00 71.30 |
| 51.80 31.10  2.50 10.00 37.10 15.60 |
| 17.40 98.90 45.10 12.80  1.50  1.90 |
| 38.40 53.60 57.50 60.60 61.10 17.50 |
| 66.60 45.60 35.90  6.60 61.20 78.50 |

| ( 0.0397,-0.3961i) ( 0.7519, 0.4533i) ( 0.9117, 0.8514i) |
| ( 0.0787,-0.7153i) (-0.0759,-0.5294i) ( 0.7244,-0.5808i) |
| ( 0.5593, 0.6873i) ( 0.9935, 0.9993i) ( 0.2230,-0.2151i) |
| (-0.4676,-0.4055i) ( 0.6802,-0.9525i) (-0.2483,-0.8148i) |

See Also

FillRandom Method

Applies To: Matrix | CMatrix