简体   繁体   中英

How do we assign value to variable to later use in LabView?

I'm reading dynamic data from a sensor in LabView and I'm trying store the initial value for the first position of the device to compare and use for the zero value.

I've tried to create an array and store it as an element inside of case-structure which is activated via boolean button but for some reasons the output of case-structure can't be used. I've seen people successfully using the shift registers but in LabView 2017 it seems I only can use feedback node . What's the easiest way to implement such a structure?

Expected result would be assigning a single data-point read from sensor to a variable. I'm using LabView 2017.

Note :It seems in LabView 2017 using shift register by right click on wire is not the option anymore !

Update : below is the snippet of program:图片

When you have a wire on the tunnel of a looping structure, you can right click, and change the tunnel mode to Shift Register. So I'm not sure what you mean by saying you can only use feedback nodes.

右击隧道

It sounds like you have a while loop in which you take your measurements. You can use its loop iteration terminal to determine whether you are measuring your initial (or first ten) measurements. You can then store these values in a shift register to be available for future measurements to use. You just need to stop updating your shift register once you have acquired your initial (or first ten) measurements.

The VI snippet below shows a way of achieving this. The case structure has only one other not visible state that is the default case where the first 10 readings array is simply wired straight through and so unchanged.

Without further details, it is difficult to say whether this does answer your question. If it doesn't then I would suggest posting a snippet of your code or at least enough to show how it is currently working.

Have you tried using the elapsed time function? This way you can create an array and get the mean for the first x seconds. 在此处输入图片说明

Alternatively, you can use a state machine in which you create a separate 'calibration' state where you perform this action. The state machine also allows you to initialize and stop the hardware properly. Keeps your code more readable and scalable.

Best regards, San

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM