LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract data from inside while loop without stopping the loop.

As the title. Is there any way to extract the data inside while loop without stopping the loop itself?
0 Kudos
Message 1 of 10
(4,867 Views)
Local variables, global variables, shared variables, queues, notifiers, action engines, TCP/IP communications, null modem cables with multiple serial ports .....  Take your pick.
Message 2 of 10
(4,866 Views)

Base on ur suggestion i tried using local variable and global variable but don't help. it still needs to wait for the while loop to stop before updating the variable.The rest are new to me....... will try them after some reading or u can help to elaborate the one u think easiest ...... thx.

 

 

 

 

0 Kudos
Message 3 of 10
(4,846 Views)

Hi hito88,

 

when the locals "don't work", then the rest will show problems too...

 

You have to think in "dataflow", not in "variables". Probably your while loop is blocking the dataflow and so the updating of the indicator. Show us some code to get more/better help.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 10
(4,838 Views)

Hi,

 

 As GerdW told, you are some where blocking the data flow. I give you example to pass the data through the locals.

 

Local.JPG

 

Use local variables to access front panel objects from more than one location in a single VI and pass data between block diagram nodes that you cannot connect with a wire.With a local variable, you can write to or read from a control or indicator on the front panel. Writing to a local variable is similar to passing data to any other terminal. However, with a local variable you can write to it even if it is a control or read from it even if it is an indicator. In effect, with a local variable, you can access a front panel object as both an input and an output.

For example, if the user interface requires users to log in, you can clear the Login and Password prompts each time a new user logs in. Use a local variable to read from the Login and Password string controls when a user logs in and to write empty strings to these controls when the user logs out.

Creating Local Variables

Right-click an existing front panel object or block diagram terminal and select Create»Local Variable from the shortcut menu to create a local variable. A local variable icon for the object appears on the block diagram.

You also can select a local variable from the Functions palette and place it on the block diagram. The local variable node, shown as follows, is not yet associated with a control or indicator.

 

Message Edited by Baji on 08-14-2009 02:05 PM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
Message 5 of 10
(4,828 Views)

Thx for all the reply. Great, I did manage to extract the data at last using the variables... I can see that global variable is a memory eater..... I extracts only one 2D array of video data and my computer lags like crazy ...

 

From the suggestions by Ravens Fan any one of them that is "memory efficient"?

 

Herei also attach my vi but u will need IMAQ and IMAQ for USB.

0 Kudos
Message 6 of 10
(4,807 Views)

What are you trying to do? Can you explain because I have none IMAQ experience. But it looks like you are doing some typical Labview beginner faults. Perhaps you should take a look at some online tutorials. Have you browsed through some Labview examples. You find Labview examples like this. Go to help in toolbar, select Find Examples, then search.

Good luck



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 10
(4,796 Views)

hito88,

 

     You need to keep the indicator(for which you created local variable) in the loop and the data need the wired to the subVI. use Queues to pass the data to avoid racing conditions.

      This is very good example Queue Vs Locals.

Message Edited by Baji on 08-14-2009 04:34 PM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 8 of 10
(4,788 Views)
The way the image is acquired from the USB device should be changed into slightly differance fashion.  Will post you the vi by monday.
With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 9 of 10
(4,785 Views)

Oh, boy!  I sure do hate local/global/shared variables and wish I could convey my disdain effectively.  Avoid getting in the habit of using them as they're rarely necessary or appropriate.  If your loop is producing data to be consumed somewhere else, you have a "Producer-Consumer" situation and would be well served by reviewing that architecture.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 10 of 10
(4,779 Views)