LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort the maxvalue from realtime chart

How to sort the max value of the Realtime sort, because the array is dynamical.

My Idea is in the attach. 

0 Kudos
Message 1 of 6
(346 Views)

There is a function Array Max/min 

LVNinja_0-1716495423877.png

 

0 Kudos
Message 2 of 6
(322 Views)

I know but the problem is the data is realtime 

0 Kudos
Message 3 of 6
(320 Views)

I would start with the learning resources listed at the top of the forum, because your code makes very little sense.

 

  • Your while loop operates on the very same data billions of time a second forever, and since the indicator is after the loop, it will never show anything. It would show after you stop the loop, but since you wired a FALSE constant, all you can do is abort the VI and the indicator will never receive any data.
  • If you want to operate on new data, both the waveform acquisition and the indicator needs to be inside the loop. Dataflow! Also place a reasonable wait to define the loop rate.
  • If you just want the max value, you don't need to sort, just use "array min&max".
  • The term Realtime has a very specific meaning in engineering. I doubt you are using LabVIEW RT and relevant hardware. I assume you just want to show the max whenever new data arrives.

 

Here's a quick simulation:

 

altenbach_0-1716495942863.png

 

 

or even:

 

altenbach_0-1716496076208.png

 

If you want to keep track of the global max, that would be easy too. (there is also a ptbypt function for same)

 

altenbach_0-1716496199775.png

 

0 Kudos
Message 4 of 6
(316 Views)
0 Kudos
Message 5 of 6
(298 Views)
  • Do not attach a new VI with exactly the same name as an old VI attach earlier.
  • You did not listen to our advice (loop cannot be stopped, loop has no timing, etc.)
  • Your VI does two different ways tho get the max, the simpler way is sufficient. (O(N) vs O(NlogN))
  • Does it work and do what you expect it to do?
0 Kudos
Message 6 of 6
(269 Views)