Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileMAT READ a() MAT PRINT [#i,]a()[,g,n] MAT INPUT #i,a() i, g, n: iexp a: name of field with numeric variables MAT READ a() reads a previously dimensioned matrix or vector from DATA rows. Example: DATA 1,2,3,4,5,6,7,8,9,10 DIM a(2,5) MAT READ a() PRINT a(2,4) --> Outputs the value 9. MAT PRINT [#i,]a()[,g,n] outputs a matrix or a vector. Vectors are output on one row, the elements being separated by commas. With a matrix, each row is followed by a rowfeed. The output can optionally be redirected with #i, as with PRINT. If g and n are specified, the numbers are formatted as with STR$(x,g,n). Example: DATA 1,2.33333,3 DATA 7,5.25873,9.376 DATA 3.23,7.2,8.999 DIM a(3,3) MAT READ a() MAT PRINT a() PRINT "-----------------------" MAT PRINT a(),7,3 --> Outputs: 1, 2.33333, 3 7, 5.24873, 9.376 3.23 7.2, 8.999 ------------------- 1.000, 2.333, 3.000 7.000, 5.259, 9.376 3.230, 7.200, 8.999 MAT INPUT #1,a() reads a matrix or vector from a file in ASCII format (the format being the reverse of MAT PRINT, commas and rowfeeds may be varied as with INPUT #). Example: OPEN "o",#1,"Test.DAT" DIM a(3,3) MAT ONE a() MAT PRINT #1,a() CLOSE #1 MAT CLR a() OPEN "i",#1,"Test.DAT" MAT INPUT #1,a() CLOSE #1 MAT PRINT a() --> Outputs: 1,0,0 0,1,0 0,0,1 Memo: The statement 'MAT INPUT a()' crashes the compiler! Perhaps the #channel is not suppose to be optional and the tokenizer fails to syntax check it correctly? The example above does not even work, so perhaps MAT INPUT regardless of the parameters is just plain broken? MAT READ fails in the editor with 'Out of data' but works compiled. MAT PRINT a() !works MAT PRINT a(),g,n !fails, always prints 0s MAT PRINT works ok compiled.