WizardOz Member Licensed User Longtime User Dec 11, 2011 #1 Dear B4A-gurus, I am writing to you because my mind has stopped working, and I need to get it going again... Is there an easy way of saving / loading a multidimension-array, preferable in a readable and writable (texteditor) format? My array will only contain numbers in the INT format. The format of the array is (x,2). For now I am writing it in code: Code: Copy Arr(1,0) = 10 Arr(1,1) = 2 Arr(1,2) = 5 Arr(2,0) = 11 Arr(2,1) = 4 But as I am going up to a couple of hundred it will be a LOT of code-lines (and as the IDE dont save the state of show / hide subs this gives a lot of scrolling, but thats another thing completly), the point being that a text-file would be a great way of adding more lines to the array. Do you guru's have any ideas? Pretty please with sugar on top? :sign0163:
Dear B4A-gurus, I am writing to you because my mind has stopped working, and I need to get it going again... Is there an easy way of saving / loading a multidimension-array, preferable in a readable and writable (texteditor) format? My array will only contain numbers in the INT format. The format of the array is (x,2). For now I am writing it in code: Code: Copy Arr(1,0) = 10 Arr(1,1) = 2 Arr(1,2) = 5 Arr(2,0) = 11 Arr(2,1) = 4 But as I am going up to a couple of hundred it will be a LOT of code-lines (and as the IDE dont save the state of show / hide subs this gives a lot of scrolling, but thats another thing completly), the point being that a text-file would be a great way of adding more lines to the array. Do you guru's have any ideas? Pretty please with sugar on top? :sign0163:
Erel B4X founder Staff member Licensed User Longtime User Dec 11, 2011 #2 If you want a text file then you can use StringUtils.SaveCSV: Basic4android - StringUtils. You will need to write some code that converts the array to a list. RandomAccessObject.WriteObject / ReadObject is simpler but the file will not be a text file. Upvote 0
If you want a text file then you can use StringUtils.SaveCSV: Basic4android - StringUtils. You will need to write some code that converts the array to a list. RandomAccessObject.WriteObject / ReadObject is simpler but the file will not be a text file.
WizardOz Member Licensed User Longtime User Dec 11, 2011 #3 Thanx for the pointers, Erel. But, by using the search-field :BangHead: with cleverly keywords in random order I found this post by Kamac: http://www.b4x.com/forum/basic4android-updates-questions/10106-multi-dimension-arrays.html#post56039 A very fine example of what I was hoping to find. We should really start having a cockbook of these examples! Upvote 0
Thanx for the pointers, Erel. But, by using the search-field :BangHead: with cleverly keywords in random order I found this post by Kamac: http://www.b4x.com/forum/basic4android-updates-questions/10106-multi-dimension-arrays.html#post56039 A very fine example of what I was hoping to find. We should really start having a cockbook of these examples!
stevel05 Expert Licensed User Longtime User Dec 11, 2011 #4 There is an awful lot of knowledge on these forums already, sometimes it just takes a little patience and/or creative searching to find it. Upvote 0
There is an awful lot of knowledge on these forums already, sometimes it just takes a little patience and/or creative searching to find it.
WizardOz Member Licensed User Longtime User Dec 11, 2011 #5 1There is an awful lot of knowledge on these forums already, sometimes it just takes a little patience and/or creative searching to find it. So true, this quote should be on the B4A logo! Upvote 0
1There is an awful lot of knowledge on these forums already, sometimes it just takes a little patience and/or creative searching to find it. So true, this quote should be on the B4A logo!
Cableguy Expert Licensed User Longtime User Dec 15, 2011 #6 In the code found by Karmac, wich was originally posted by me, "Level" is a global variable... The fie was a basic score table and the out put was something like : Level1 03m20s, 487 03m31s, 398 .............. Level2 07m21s, 732 08m02s, 695 ...... The code in the example reads the "Level" portion of the file, filing the 25 slots ( 5 time stamps, 5 sores), thus discarding whatever is left of the file... Note that in my case, the file had a known values count.... Last edited: Dec 15, 2011 Upvote 0
In the code found by Karmac, wich was originally posted by me, "Level" is a global variable... The fie was a basic score table and the out put was something like : Level1 03m20s, 487 03m31s, 398 .............. Level2 07m21s, 732 08m02s, 695 ...... The code in the example reads the "Level" portion of the file, filing the 25 slots ( 5 time stamps, 5 sores), thus discarding whatever is left of the file... Note that in my case, the file had a known values count....
nfordbscndrd Well-Known Member Licensed User Longtime User Dec 15, 2011 #7 WizardOz said: We should really start having a cookbook of these examples! Click to expand... The Documentation Wiki (see link above in yellow) is intended for that purpose. Anyone can add to it any time they find something worth preserving. Upvote 0
WizardOz said: We should really start having a cookbook of these examples! Click to expand... The Documentation Wiki (see link above in yellow) is intended for that purpose. Anyone can add to it any time they find something worth preserving.