LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

One while loop inside another

 Here is the thing, I am acquiring sound frequency through LabVIEW, this is the first attached VI. The next step is to associate each max frequency to another input data to then plot a graph. However, I am having troubles to set this, look the second attached file. Hence, I want that in the first loop ( the one inside) I want to input a new data through numeric control at each interation, but labVIEW doesn't aks me this, so how can I fix this?

 

Thanks in advance.

Download All
0 Kudos
Message 1 of 5
(2,580 Views)

Hello


Sincerely I didn't really get what you mean, but I have some ideas.

I'm not so sure (and unfortunately not able to check it now), but maybe if you want to do some operation when you have a new iteration, you can implement event structure, that do what you want when the iteration value changes, at each change.

 

 

There must be an easier way, and I'm sure the rest of the forum will help you.

 

Regards.

Mondoni
0 Kudos
Message 2 of 5
(2,559 Views)

you can do this all in 1 while loop, i do not understand your reasoning for using 2 while loops? are you asking why the XY graph is not in real time (reason: data flow)?

0 Kudos
Message 3 of 5
(2,556 Views)

apok, I just checked the VI now (back to my LV computer) and I agree with you.

Comissando, you don't need 2 loops in this case. And forget what I said about event structures, I guess it won't be necessary in your case. Please answer apok's question: 


apok escreveu:

are you asking why the XY graph is not in real time (reason: data flow)?



Regards

Mondoni
0 Kudos
Message 4 of 5
(2,549 Views)

You need to look into state machines. Use a single loop and maintain all data in shift registers. To keep track of the max, you don't need to accumulate potentially infinitely large arrays in an autoindexing tunnel, just to find the max later. Keep the current max in a shift register as a scalar and compare it with the new value at each iteration using max&min.

0 Kudos
Message 5 of 5
(2,537 Views)