LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how is this possible?

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?

 

 

Somil Gautam
Think Weird
0 Kudos
Message 1 of 14
(3,501 Views)

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?

 

Somil Gautam
Think Weird
0 Kudos
Message 2 of 14
(3,499 Views)
I am not sure if I understand your meaning of a variable and calling convention in this context, but you could look into a Ring Control. You can select items and have values assigned to each item.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 3 of 14
(3,491 Views)

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" Smiley Wink 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?

Somil Gautam
Think Weird
0 Kudos
Message 4 of 14
(3,486 Views)

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.

0 Kudos
Message 5 of 14
(3,486 Views)

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?

Somil Gautam
Think Weird
0 Kudos
Message 6 of 14
(3,479 Views)

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.

Pattos

LabVIEW Gretchin
0 Kudos
Message 7 of 14
(3,471 Views)

Hi Somil,

 

Is it possible for you to explain the bigger picture? Where exactly are you trying to use this?

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 8 of 14
(3,470 Views)

Given your spec something like this

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 9 of 14
(3,468 Views)

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

Somil Gautam
Think Weird
0 Kudos
Message 10 of 14
(3,432 Views)