# import matrix data , for use in other program.

Matrix send to file
-------------------

Sub write_matrix(filename\$,data(,))
! write matrix to file
open #1: name filename\$,create newold,org text,access outin
erase #1
set #1:Margin maxnum
Mat data = TRN(data)
Mat print #1:data
close #1
end sub

---------------------

How import this matrix in other program.

end sub

Best regards
Peter Vlasschaert

### If you are using a TEXT file

If you are using a TEXT file to store matrix data, and you are sending the data to the text file with PRINT #1: data, then you must use:
INPUT #1: data to recover data.

BE CAREFUL ! You must DIM the array of data BEFORE you PRINT the data to the file. (The DIM statement is missing in your code!).

When you recover the data from the text file, again you MUST provide a DIM statement that defines the size of the data array that you want to INPUT.

Regards
BigJohn

### read statement,data file.(problem),question write statement

Halo BigJohn

I have problem for conversion :string format to matrix read in mat b,
how to correct:

1e) write file send txt : seperated by "," =>(see below) how can be done :

call write_matrix(a\$,a(,))

find :C:\Prog\TrueBASIC GOLD v6\testa.dat
testa.dat
1.2,2.2,3.2
4.3,5.3,6.3
7.44,8.55,9.55

option nolet
dim a(1,1),b(1,1)
mat redim a(3,3),b(3,3)
mat print a
a\$ = "C:\Prog\TrueBASIC GOLD v6\testa.dat"
call write_matrix(a\$,a(,))
mat print a
mat print b
data 1.2,2.2,3.2
data 4.3,5.3,6.3
data 7.44,8.55,9.55
end

open #1: name filename\$,create newold,org text,access outin
Mat data = TRN(data)
Mat Input #1:data
close #1
end sub

Sub write_matrix(filename\$,data(,))
! write matrix to file
open #1: name filename\$,create newold,org text,access outin
erase #1
set #1:Margin maxnum
Mat data = TRN(data)
Mat print #1:data
close #1
end sub