halo how to write 3d matrix to file,to excel format and 2d matrix

option nolet
dim a(1,1,1)
mat redim a(2,2,2)
a(1,1,1)=1
a(1,2,1)=2
a(2,1,1)=3
a(2,2,1)=4
a(1,1,2)=5
a(1,2,2)=6
a(2,1,2)=7
a(2,2,2)=8
mat print a
print 1
end
read ,write :to excel

read ,write :them from file to new matrix

who are twodimensional ,call them

first matrix must contain 1,2,3,4

b(1,1)=1
b(1,2)=2
b(2,1)=3
b(2,2)=4

second matrix must contain 5,6,7,8

c(1,1)=5
c(1,2)=6
c(2,1)=7
c(2,2)=8

how can this be done