Hi all,
KSS8.3, KRC4
I was wondering if it is possible in KSS to somehow declare an array length using another variable. For example:
DECL INT ARRAYLENGTH
ARRAYLENGTH = 5
DECL REAL THEARRAY[ARRAYLENGTH]
I know that would not be the proper way to do it, but it illustrates what I am trying to do I believe.
In case anybody is curious about the application:
I am reading in ~30,000 points from a TXT file that will be used for the $vel.cp variable. I am using a raster motion (only motion in +x direction) so my code would look something like this:
FOR R = 1 TO 30000
SLIN_REL {X 1.5} WITH $VEL.CP = MYARRAY[R] C_DIS
ENDFOR
However I do not know the exact length of the array until I read in the TXT file. The way I am currently doing it is I just pre-declare an array of 32,766 elements, initialize them all as 0, and populate that array. The problem arises when I reach the "0" I want the machine to stop moving. I am worried that checking before every single SLIN_REL movement may cause some issues with the $ADVANCE variable and result in me losing my smooth motion.
Anyway... that is my application. I want to be able to read in the file, identify where my TXT file stops having real values, and declare an array of only that length (essentially removing my padded 0s).
I can be more specific or clear if necessary.
PS: I can not just change the upper limit of my FOR loop to the number of elements in my TXT file (I can explain if necessary).
Thank you!