LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to build an array using incoming stream of data?

Solved!
Go to solution

I called the block diagrams continuously..

Now I figured out MoResee's program..

Thanks all!

0 Kudos
Message 21 of 26
(1,632 Views)

I'm glad to hear it, but don't forget it was altenbach who originally suggested itSmiley Wink.  I just coded it for you.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 22 of 26
(1,624 Views)

Hi MoReese,

Seems like I still haven't got the problem solved completely..

Long story. My main program is in Vision Builder for Automatic Inspection (VBAI). I am only using the VI as an inspection interface. Anyway, seems like the 'feedback loop' method is giving me trouble.. I think when VBAI launch the VI, it is like clicking the "Run Continuously" button on the VI (I don't know why, probably that's how it work).

 

Anyway, I would like to stop the feedback loop after every iteration. How can I do this?


@MoReese wrote:

You must be running this in a loop.  Yes, the array will fill quickly if this is the case.  This was intended to execute upon a value change.  In other words, you call it when there is a new value or when you want to store the next value.  With every iteration, the value of the numeric control will be appended to the array.  What are you needing exactly?

 

array.png


 

0 Kudos
Message 23 of 26
(1,602 Views)

or maybe,, how can I make this a subVI and only call it once in my main VI?

Not sure if this question make sense.. I'm just a beginner. I just don't want the loop iteration to execute without my control.

0 Kudos
Message 24 of 26
(1,601 Views)

I don't know how the call from VBAI executes, but maybe you should not initialize the node at all. (I also don't know why you would show the enable terminal, it just complicates the code.)

0 Kudos
Message 25 of 26
(1,600 Views)

So just wanted to clarify how Custom UI works in VBAI. When you use a custom UI, the VI is loaded into memory when the inspection is opened/loaded and the controls/indicators are initialized to the values specified under Tools>>Inspection Interface Configuration in the tab Interface Initial Values. The VI is only run when an Update Inspection UI step runs that has the checkbox selected to "Run the VI after Updating Indicators". This option is only available for VIs that have code behind the front panel. You should ensure the VI will finish quickly because the step will not continue until the VI has finished running. You could use a while loop with a constant false wired to the condition to ensure it only runs once and use shift registers to keep track of your growing array. You must use uninitialized shift registers because you don't the shift register value getting reset every time the Update Inspection UI step runs. 

 

I created another option using a subVI that returns the full array in a single call. This is not officially supported and may not work in the future, but hopefully passing arrays will be more natively supported in the future. Here's a sample inspection that illustrates how to do this with a custom UI. You need to put the Get VBAI Step Result.vi in your c:\ drive (or update the Cust UI vi to point to th right location), and I included the custom UI VI so you can see how I call it. This subVI requires the step GUID of the step you want to get all the results for. This step GUID can be determined by:

1 - using the LabVIEW API to get info for all steps (I included a VI to illustrate how to use this method).

2 - generating LV code and digging through it to find the step GUID.

 

If you delete the step you want to get results for, you will need to determine the step GUID of the new step using one of these methods again.

Hope this helps,

Brad

Message 26 of 26
(1,567 Views)