Next thinBasic beta release will have JOIN$ working also on matrix.
It will be possible to inindicate element and row separators plus format for numeric elements.
Example
[code=thinbasic]
Uses "console"
Uses "math"
Dim MaxX As Long = 3
Dim MaxY As Long = 3
PrintL "Defining matrix a and b:", MaxX, "by", MaxY
Dim a(MaxX, MaxY) As Double
Dim b(MaxX, MaxY) As Double
PrintL "Filling matrix a with", Format$(MaxX * MaxY), "numbers"
'---Note row order filling
a() = ( 1, 1, 2,
1, 2, 4,
2, -1, 0 )
PrintL "Inverting matrix a to b"
MAT b() = INV(a())
PrintL
PrintL "A is---------------------"
PrintL Join$(a, $TAB, $CRLF, " 00.0;-00.0; 00.0")
PrintL
PrintL "B is---------------------"
PrintL Join$(b, $TAB, $CRLF, " 00.0;-00.0; 00.0")
WaitKey
[/code]
Will output:
[code=dos]
Defining matrix a and b: 3 by 3
Filling matrix a with 9 numbers
Inverting matrix a to b
A is---------------------
01.0 01.0 02.0
01.0 02.0 04.0
02.0 -01.0 00.0
B is---------------------
02.0 -01.0 00.0
04.0 -02.0 -01.0
-02.5 01.5 00.5
[/code]
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Bookmarks