03-23-2012 05:05 AM
I have a set of block diagrams which builds an array - user will input 10 integer numbers and these numbers will be stored in Array_A.
Now I would like to perform some arithmetic operation to Array_A, e.g perform addition on Array_A and a constant array Array_B.
But since Array_A is an indicator, how do I make it a control, before I perform the addition?
03-23-2012 05:14 AM - edited 03-23-2012 05:14 AM
Hi Splee,
You can make use of the Local Variables of the Array Controls to write or read values to it. To create a local variable, just right click the control and click create local variable. But make sure you don't create any race conditions.
Regards,
Nitz
(Give Kudos to Good Answers, Mark it as a Solution if your Problem is Solved;))
03-23-2012 05:31 AM
Check this example. Don't use sequence structures like this in your program. I used it just to show you how the local variable works.
Regards,
Nitz
(Give Kudos to Good Answers, Mark it as a Solution if your problem is Solved;))
03-23-2012 05:40 AM
"The wire is the variable". Since you generate your data and wire the result to the indicator, you already have a wire with the "expected" data, don't you?
Think of the LV block diagram a little like a printed circuit in electronics. How would you pass on a signal from a given source to a measurement point (e.g. the indicator) and a following element like an OP?
Correct - a branch.
So go for it.
If the data is required within a loop, but different iterations and it has to change, use shift registers.
Variables are the least option you should ever think off (if at all.....).
thanks,
Norbert
03-23-2012 05:55 AM
Hi Norbert,
Thanks for pointing this out. I failed to read the post well enough that i posted such a suggestion. I explained here how to update a control with two different values (at different instatnces) and while creating an example for showing it, i unknowingly explained what you just stated (taking the wires to send data) 🙂
Thanks again..
Regards,
Nitz
03-23-2012 09:22 AM
"user will input 10 integer numbers and these numbers will be stored in Array_A." "Array_A is an indicator"
You should never store anything in an indicator, nor consider the indicator a variable.
The wire is the storage and variable. The indicator is a window to see it's data.
/Y
03-23-2012 10:44 AM
Hi Yamaeda,
If on the front panel I have a numeric control to let user key in any number and I would like to store e.g the 10 different numbers the user key in, how would I do so?
I thought storing in an array indicator would be a natural solution. Could you please advise which method should be used?
Can a wire store a series of number?
03-23-2012 10:46 AM
Hi Norbert,
I am a novice and I don't understand how a wire can be used to store a series of data.
Could you please show me an example?
Thank you.
03-23-2012 11:26 AM - edited 03-23-2012 11:27 AM
Pretty basic: