Author |
Topic: Is it possible to save a 3D array to disk (Read 546 times) |
|
Danny72
New Member
member is offline


Posts: 20
|
 |
Is it possible to save a 3D array to disk
« Thread started on: Aug 24th, 2010, 3:52pm » |
|
Hello everyone,
Could someone let me know if it is possible to save a 3D array to Hard Drive.
e.g.
a$(x,y,z)
If so, could you perhaps let me know the exact code to type in, to save and retrieve array.
Many thanks.
Danny
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Is it possible to save a 3D array to disk
« Reply #1 on: Aug 24th, 2010, 10:41pm » |
|
on Aug 24th, 2010, 3:52pm, Danny72 wrote:Could someone let me know if it is possible to save a 3D array to Hard Drive e.g. a$(x,y,z) |
|
As it's a string array the easiest way is to save/load the individual elements:
Code: DEF PROCsave3Darray(F%, a$())
LOCAL I%,J%,K%
FOR I% = 0 TO DIM(a$(),1)
FOR J% = 0 TO DIM(a$(),2)
FOR K% = 0 TO DIM(a$(),3)
PRINT #F%, a$(I%,J%,K%)
NEXT
NEXT
NEXT
ENDPROC
DEF PROCload3Darray(F%, a$())
LOCAL I%,J%,K%
FOR I% = 0 TO DIM(a$(),1)
FOR J% = 0 TO DIM(a$(),2)
FOR K% = 0 TO DIM(a$(),3)
INPUT #F%, a$(I%,J%,K%)
NEXT
NEXT
NEXT
ENDPROC In each case the first parameter is the file's channel number, as returned from OPENIN, OPENOUT or OPENUP. So for example to save the array you could do:
Code: chan% = OPENOUT(@tmp$+"array.dat")
PROCsave3Darray(chan%, a$())
CLOSE #chan% Richard.
|
|
Logged
|
|
|
|
Danny72
New Member
member is offline


Posts: 20
|
 |
Re: Is it possible to save a 3D array to disk
« Reply #2 on: Aug 25th, 2010, 11:47am » |
|
Thank you very much as always.
Danny
|
|
Logged
|
|
|
|
|