Dear All
Please help me; I am fairly desperate because of my unability to retrieve multidimensional arrays (from 3 dimensions upwards) containing integers. The problem can be illustrated by the following example:
Given the 3-dimensional table "little%", i.e. an array declared with
DIM little%(2,3,2)
and stored (successfully, I checked that with a plain text editor) on disk with
OPEN "little_table.tab" FOR OUTPUT AS #1
PRINT #1, little%()
CLOSE #1
PB seemingly can not read the array out again. Any attempt (or rather umpteen attempts in many imaginable variations) to retrieve it with something like:
OPEN "little_table.tab" FOR INPUT AS #1
INPUT #1, little%(2,3,2)
CLOSE #1
invariably result in a non-return voyage to never-never-land, complete with Microsoft's farewell kiss "sorry for the inconvenience" etc...
Variants like <INPUT #1, little%()> triggered either an immediate complaint by the compiler, or the same crash. What went wrong? It seems difficult to imagine that PB has no procedure for reading in arrays which it itself stored in the column-major order !
- Please note that before annoying the community with what may be a beginners problem with PB (although I was an old hand at Turbo-Pascal ages ago, until Version 6 or 7 if I remember rightly), I checked the Forum back as far as the last Great Ice Age (MANY thanks to Steve Rossell for his invaluable, brand-new Boolean search tool which makes life so much easier !). This included for instance reading Aldo Vitagliano's suggestions back in the year 2000 and many others, but I found no answer to the actual question above. Maybe I searched inaccurately...
- The often proposed nested "for I=1 to ..." loops will scarcely do, if only because these become too cumbersome for handling certain later calculations which involve a large number of dimensions. I did read the numerous apt warnings about too many dimensions, in the Manual and elsewhere, but in the present case they are practically unavoidable. Actually, any odd language can handle arrays with an arbitrary number of dimensions through the use of nested "for I=1 to ...", but a main reason why I recently chose PB - besides its many obvious qualities and its considerate support - was its ability to gracefully handle up to 8 dimensions if the need arose, or so I thought.
- Storage in binary form is inappropriate. The arrays represent statistical states of physical systems, and the stored files must be not be limited to use with PB, but written in a standard form simply recoverable by a motley crowd of physicists and statisticians. PB's column-major order is ideal for the purpose. I am fully aware that this kind of reading necessitates stating the number of dimensions of the array and the extent of each. ¿Must this be done in a way which differs from the explicit use of the identification <little%(2,3,2)> (in the present example)?
I hope this will not give too much trouble, and sincerely thank in advance for any forthcoming help.
Lucien Preuss (Switzerland)
Please help me; I am fairly desperate because of my unability to retrieve multidimensional arrays (from 3 dimensions upwards) containing integers. The problem can be illustrated by the following example:
Given the 3-dimensional table "little%", i.e. an array declared with
DIM little%(2,3,2)
and stored (successfully, I checked that with a plain text editor) on disk with
OPEN "little_table.tab" FOR OUTPUT AS #1
PRINT #1, little%()
CLOSE #1
PB seemingly can not read the array out again. Any attempt (or rather umpteen attempts in many imaginable variations) to retrieve it with something like:
OPEN "little_table.tab" FOR INPUT AS #1
INPUT #1, little%(2,3,2)
CLOSE #1
invariably result in a non-return voyage to never-never-land, complete with Microsoft's farewell kiss "sorry for the inconvenience" etc...
Variants like <INPUT #1, little%()> triggered either an immediate complaint by the compiler, or the same crash. What went wrong? It seems difficult to imagine that PB has no procedure for reading in arrays which it itself stored in the column-major order !
- Please note that before annoying the community with what may be a beginners problem with PB (although I was an old hand at Turbo-Pascal ages ago, until Version 6 or 7 if I remember rightly), I checked the Forum back as far as the last Great Ice Age (MANY thanks to Steve Rossell for his invaluable, brand-new Boolean search tool which makes life so much easier !). This included for instance reading Aldo Vitagliano's suggestions back in the year 2000 and many others, but I found no answer to the actual question above. Maybe I searched inaccurately...
- The often proposed nested "for I=1 to ..." loops will scarcely do, if only because these become too cumbersome for handling certain later calculations which involve a large number of dimensions. I did read the numerous apt warnings about too many dimensions, in the Manual and elsewhere, but in the present case they are practically unavoidable. Actually, any odd language can handle arrays with an arbitrary number of dimensions through the use of nested "for I=1 to ...", but a main reason why I recently chose PB - besides its many obvious qualities and its considerate support - was its ability to gracefully handle up to 8 dimensions if the need arose, or so I thought.
- Storage in binary form is inappropriate. The arrays represent statistical states of physical systems, and the stored files must be not be limited to use with PB, but written in a standard form simply recoverable by a motley crowd of physicists and statisticians. PB's column-major order is ideal for the purpose. I am fully aware that this kind of reading necessitates stating the number of dimensions of the array and the extent of each. ¿Must this be done in a way which differs from the explicit use of the identification <little%(2,3,2)> (in the present example)?
I hope this will not give too much trouble, and sincerely thank in advance for any forthcoming help.
Lucien Preuss (Switzerland)
Comment