From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-25-2018 06:52 AM - edited 04-25-2018 06:53 AM
@Yamaeda wrote:
Is this what you're meaning?
Why so complicated?
04-25-2018 02:24 PM - edited 04-25-2018 02:25 PM
@crossrulz wrote:
Why so complicated?
You might want to slow down that loop on the bottom just a little bit 😄
You also want to set "return elements?" to TRUE.
Still I am not sure about the original problem. If the data is just the iteration count, all we need is get the last element and the other 99 can be calculated from first principles in the target loop. A single element lossy queue, even a local variable might be all that's needed.
04-25-2018 02:52 PM - edited 04-25-2018 02:53 PM
Something like this? It's unclear from your description what you're trying to accomplish.
04-25-2018 02:57 PM
Yes that is more optimized, but less akin to how it was described. 🙂
/Y
05-04-2023 02:31 AM
Is there an equivalent way to this code implementing a circular buffer, but using a Lossy Stream Channel? I can't seem to find an equivalent to Get Queue Status: Return Queue Elements that is needed for the second while loop in this code.
Things I've tried:
1. Setting a Stream Channel writer to fixed size N, timeout=0 and reading N elements with a Read Multiple Channel Reader.
2. Connecting a Lossy Stream to a Read Stream (broken wire)
3. Tag channel with array that is loaded using array functions to shift and append the array in the producer loop (but I'm trying to do this using a stream channel - just want an equivalent to the simplicity of a lossy queue using channel wires)
05-04-2023 02:30 PM
Before worrying about how to do something, think about what you want to do. So "What do you want to do"?
The reason I ask is that I'm having great difficulty imagining a scenario where one needs a (finite, specified-length) Circular Buffer where the Reader "lags" the Writer (by a fixed amount? by a variable amount? by a changing amount?). Of course, a Delay Line is an obvious example, and having such a concrete example, the concrete "solution" suggests itself.
[Many moons ago, I read an interesting book on implementing Data Structures such as Queues, Circular Buffers, and other "modern" data constructs using Fortran 4.0. The Fortran "solution" is an "obvious" simple method for a Delay Line ... ]
Please explain (without worrying about the "Hows") what, exactly, is the Task that you are trying to accomplish? What are the inputs? What are the hoped-for outputs? What "variables" link Inputs to Outputs?
Bob Schor