LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a number from keyboard(like scanf in c)

Like in c language if we use a scanf statement in a loop , every time at each iteration it will ask for the value to read from keyboard and pauses the process until the value read. How can we implement it in labview? Please help me.

0 Kudos
Message 1 of 4
(2,730 Views)

Hi Suri,

 

You will most likely need to use event structures. If you are happy to have a string control the user can type into the control and you can read it when they complete typing (Create a string control value change event)

 

If you want the user to be able to type all the time and not into a string input you can have a look at this post.

http://labviewdownunder.blogspot.kr/2009/11/binding-keys-to-buttons.html You will still need to look for events but it will be key down event. You can append each new key to the end of the string

 

EDIT:

To get the number you can then use the string palette->scan from string function and specify a number input.

 

Good Luck

0 Kudos
Message 2 of 4
(2,727 Views)
Keydown-eventn:
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 4
(2,703 Views)

I think thse closest to what you are looking for is the ExpressVI: "Prompt User For Input".  It will open a pop-up and wait for the user input!

 

Othewise, if you are concerned on a "key by key" input, the other two suggestions are good but you can also take a look at the example "C:\Program Files (x86)\National Instruments\LabVIEW 2011\examples\input\InputDemo.llb\Basic Input Demo.vi" for a different alternative, not Event driven.

 

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