|
Forum Index : Microcontroller and PC projects : Array initialisation
| Author | Message | ||||
| f2cf1g Newbie Joined: 18/11/2016 Location: United KingdomPosts: 13 |
I need to initialise a lookup table of 120-odd integer elements. I can't put the initialisation values one line nor can I split it over several lines. The only method that I can think of is to write some code to load multiple DATA statements into the array during initialisation. I'm new to MM Basic and was wondering if there is a more elegant method of doing it? |
||||
| Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
How many characters in each integer? You ma be able to set a couple of string variables & read them in bit by bit in a loop using Val & Mid$. Something a bit like this. (Not sure the synatax is correct, but should give you the picture. Edit, DATA can probably also be imported with a similar loop. Phil Edit again.. Others might comment on if what's below would work. |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1671 |
Hi Roy, maybe a job for Nathan's newest invention (simpleArrayFuncGen)? This could save time and space (memory). See also http://www.thebackshed.com/forum/forum_posts.asp?TID=10040. Kind regards Michael causality ≠ correlation ≠ coincidence |
||||
| f2cf1g Newbie Joined: 18/11/2016 Location: United KingdomPosts: 13 |
I was afraid that the simplearraygeneration might be something relevant to my problem! Life is too short for that sort of complexity given I only have 120 numbers to deal with. I will use your second example Phil, with several data statements. Thanks both for you help. Roy |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |