PLUS+1 User Forum
PLUS+1 Tools => PLUS+1 GUIDE => Topic started by: LBee11 on February 20, 2017, 01:03:02 PM
-
Hi All,
I've been messing about with Arrays more and have run into a "less than desirable" issue. It's not a show stopper, but it's ugly and I'm wondering if there's a better way to do it.
I have a POU that looks after an instruction queue. It lets the user load an instruction index number and the POU will store it in a first in/first out fashion using an Array. The Array is 100 elements long. When I come to define this Array using the "Multi-Character" constant component, do I really have to define it like this:
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Array[100]S16
It works, but it's ugly and defining 100 elements does not seem practical, especially when the manual states you can have 32767 elements in an Array??
Am I missing something here?
Thanks :)
-
If you define an array with 1 element and then use Copy of Array to copy it to an array with 100 elements it will fill it with zeros.
-
I use an excel sheet for managing and documenting the array default values. It can be imported into Guide as a text file.
-
Thanks both for the responses, interested in the excel file approach. Is it possible to post a screenshot of how you set the excel sheet up?
-
You can set up the spreadsheet however you want - Use rows and columns to define the values. When you export it, only export the numbers and use a comma delimited format.
-
Thank you ZanInno,
I've made a little spreadsheet that spits out a txt file with the Array in it. Works much better than typing them all out![/size]