07-31-2013 09:53 AM
I'm trying to do two things with arrays in a stimulus profile:
1. Assign a constant value, e.g. MyArray = [1,2,3,4] This fails on compile stating it is unable to parse beginning at '[1,2,3....' I guess the work around is just to create/define the variable with this default value, but if I ever wanted to redefine the array I would have to indivually change elements, e.g. MyArray[0] = 5; MyArray[1]=6, etc.
2. Pass a constant array to another sequence, e.g. MyExpression(true, false, [1,2,3,4 ]) This fails in the same manner.
I'm scripting these profile's so I can work around these issues by just creating a local variable with the desired value as its default and pass that local to MyExpression. Am I missing something or array assignments and passing constant arrays not supported? (VeriStand 2012)
08-01-2013 03:09 PM
Hi,
The Stimulus profile editor does not support that syntax for array constants. What you're finding is correct - you have to set the array values one index at a time within the Stimulus Profile Editor (although you could right a function to do it quickly for you). I believe passing the arguments fails because the Editor does not recognize [1,2,3,4] as an array. You would have to pass a variable defined as an array witht he values for the indexes set to 1, 2, 3 and 4.
08-01-2013 03:10 PM
You might consider requesting this feature on ni.com/ideas. It does seem like it would be a good feature for making the use of arrays within the Stimulus Profile more user friendly.
09-04-2018 04:47 PM
I was looking for this for a long time, I need this on most of my programs and is really annoying to need to assign values one by one. Must be an update for future versions.