VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Constant array assignments in stimulus profile

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)

Message 1 of 4
(5,744 Views)

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.

Message 2 of 4
(5,726 Views)

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.

Message 3 of 4
(5,725 Views)

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. 

0 Kudos
Message 4 of 4
(2,274 Views)