LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to take the output from a while loop out to do comparison

Solved!
Go to solution

Hello all!

 

I got a problem with my labview project, that I'm asked to make comparsion with

 

2 output values, both of which are inside its while loop.

 

To clarify this question, I have 2 data inputs, they are read in 2 while loops respectively once a time.

 

Now I need to extract these read values outside the while loop to make comparison. However simply

 

wiring the 2 outputs out to a comparison function doesn't work. From the the highlight execution function

 

I can see that the data never gets out from the loop!

 

So I'd ask if anyone got any idea, thanks!

 

Chao

0 Kudos
Message 1 of 16
(3,383 Views)

There is something called 'Messaging Techniques' to pass data among prallel loops, different parts of a code, different VIs...

 

You can use either Queue or LV2g and there are many other ways to transfer the data... Local variable could be easiest but not recommended as can cause RACE condition.

 


@jcraffael wrote:

I can see that the data never gets out from the loop!


While loop (or any other structure) will output data only after it completes execution and not in between.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 2 of 16
(3,379 Views)

Hey thanks a lot for your reply! But a question in detail: for the queue method, should I put a certain queue function (enqueue element function or obtain queue function) between the comparison and the output shift register of the loop? Would this realize that the local data in the while loop are compared once a time outside the loop?

thanks

 

Chao

0 Kudos
Message 3 of 16
(3,363 Views)

@jcraffael wrote:

should I put a certain queue function (enqueue element function or obtain queue function)


Yes, to use queue functionality definitely you need to place those function nodes in your code.

 


@jcraffael wrote:

between the comparison and the output shift register of the loop?


Without seeing your code, can't say where to place the functions in your code.

Why don't you share your code and someone here will help you better.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 4 of 16
(3,357 Views)

 

0 Kudos
Message 5 of 16
(3,351 Views)

0 Kudos
Message 6 of 16
(3,346 Views)

God I really have no idea how to show u the code here! I could describe.

 

I just used the UDP read vi from labview example. i put two same blocks of UDP read while loops together just want to compare the

 

2 UDP data from 2 ports. I put a comparison outside the 2 loops and simply wired the 2 ouputs to it.

 

So I want to know if i should firstly wire the 2 outputs from 2 while loops firstly to 2 queue functions repectively and then to the comparison

0 Kudos
Message 7 of 16
(3,344 Views)

You can directly attach VIs to the post (section "Attachments", simply browse for the file(s)).

 

There was a bug in the forums which might still be present: Selecting "Preview" before actually posting removed all attachements from the post.

 

So maybe, you want to try again.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 16
(3,340 Views)

ok let me try

0 Kudos
Message 9 of 16
(3,334 Views)

Cant see any comparision happening in your code...!! Smiley Surprised


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 10 of 16
(3,314 Views)