10-07-2009 05:29 AM
Hi
How can i represent a number by a variable? For example: if the value of the certain variable x is 2, then i want by just calling the variable, the number should be called.
How is this possible?
10-07-2009 05:35 AM
More clarification can be from the following example.
Let x= 12
Let y= 7
Here, i am assuming the values of x and y to be 12 and 7 respectively. So, where ever i call x or y, automatically it will get linked to there values. How can i do this in LabVIEW?
10-07-2009 05:52 AM
10-07-2009 06:02 AM
Thanks zafar for the reply.
Ok, that is certainly not what i want.
Just consider the case of local variable. What happens there is we create a local variable for a control and its value can be called anywhere.
Similar to that, i want two variables say "zafar" and "somil" Zafar's value is 11 and somil's value is 12.
If i write zafar somewhere, i am linking it to 11. Similar with 2nd variable.
Now understood?
10-07-2009 06:07 AM
Hi, if i understood well you would like to store a numeric value in a numeric variable.
Supposing that your numeric value consists of a numeric constant placed in the block diagram and that you would like to store its value in a global variable, things to do are:
1 - In the block diagram, right_single_click on a blank area in order to open "Functions" palette.
2 - Select "Structures -> "Global Variable" and place the related icon (which is still void) near the numeric constant.
3 - Left_double_click on the global variable icon just to open its front panel (auomatically called, for example, "Global 1").
4 - Left_single_click_and_hold the left mouse button on the numeric constant placed in the block diagram and drag it onto the opened front panel.
5 - A numeric control (called, for example, "Numeric") will be added automatically on the front panel.
6 - Switch to the block diagram again, left_single_click on the global variable and select "Numeric".
7 - Wire the numeric constant to the numeric variable.
Your numeric value is now stored in a numeric global variable which can be used in the same VI or in any other subVI.
10-07-2009 06:18 AM
ok
I think this should be understandable
Suppose i write ABCD, A=1, B=2, C=3, D=4
Writing ABCD should give me a final number 1234, Now again if i write DCAB, then it should give me a number 4312.
All constants linked to the variable. This way Now understood or should i xplain with some other example?
10-07-2009 06:27 AM
Hi Somil,
if you just want to use the value in one VI and therefore have somthing like a local variable, you yould try working with references.
Right click your numeric control and build a reference.
You can then either use this reference to give the numeric value to something or to give a value back to your control. depends on what you want.
I admit that this is not a very elegant way, but it worked for small applications.
You could also try to just build a local variable by right clicking your num control.
I hope that this was any help.
10-07-2009 06:29 AM
Hi Somil,
Is it possible for you to explain the bigger picture? Where exactly are you trying to use this?
10-07-2009 06:29 AM
Given your spec something like this
10-07-2009 06:46 AM
Reference!!!!!!!!!!!, Yes, thats the correct word.
And zafar, see, i am trying to build an application to make combinations. for example, a 4 digit number has 24 combinations. So, i was trying to obtain them in the following way.
take 4 variables ABCD for a 4 digit number. Make a refernce of digit to one variable such as A=1, B=2, C=3, D=4. Get all 24 combinations of ABCD and save the final combinations by linking the variables to the digits.
I have already done it using nested for loops