LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting of variables in VIs

See KnowledgeBase article: 1IF7T7X4 - If you replace the indicator with an indicator array it does not reset on repeated calls.

Why does this behave differently.
0 Kudos
Message 1 of 3
(2,650 Views)
Patrick,

That is an interesting observation. I am not certain why the behavior is not seen with arrays, but if I had to guess, I'd say because an array starts off defaulted to null values, whereas a scalar value defaults to having an actual numeric value (usually 0.00). The scalar will go back to the default value as described in the KnowledgeBase entry, but I guess since the array's default value was null, it simply keeps its current values.

That is the best explanation I can come up with. I hope it made sense.

Have a good day.

Sincerely,
Darren Nattinger
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,650 Views)
Darren,

Thank you for your comments. I have been working further on this problem and discussed it with colleagues and it gets more convoluted by the minute. The behaviour is affected by whether the indicator (integer or array) is attached to the connector pane! If you take the original example in the knowledgebase and disconnect the indicator from the connector pane, the value is retained between executions. It so happened that when I tried it with an array, I had not connected the array indicator to the connector pane. I am not sure it has anything to do with 'conditional indicators' and the case statement, as stated in the article.

I come from a traditional programming background and have been very surprised at how little information there is in ma
nuals or knowledgebase on the important issue of variable lifetime. Maybe this could be addressed?

Regards,

Patrick Fischer
0 Kudos
Message 3 of 3
(2,650 Views)