LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get complete array out of a for loop and plot it after each iteration?

Solved!
Go to solution

@Blokk wrote:

Right now i do not have much time to get closer look. But one thing: are you aware that your code takes 600 msec per iteration? Not half second as you want. For that 500 msec value, use the "Wait until ms multiple" instead...


Are you sure? Whilst I agree that Wait Until Next ms Multiple might be a better choice for ensuring a regular loop time, the Waits appear to all be in parallel, so only the longest wait will do something to the outer loops iteration.


GCentral
0 Kudos
Message 11 of 30
(1,307 Views)

That's what I thought. The 500ms delay sets the sampling rate and the other small delays are running within that?

0 Kudos
Message 12 of 30
(1,302 Views)

I will try that queueing example. Thank you for that.

0 Kudos
Message 13 of 30
(1,301 Views)

I'm going to try your shift register, if only to simplify it, although I'm not sure that it keeps all the previous data packets.

0 Kudos
Message 14 of 30
(1,301 Views)

@cbutcher wrote:

@Blokk wrote:

Right now i do not have much time to get closer look. But one thing: are you aware that your code takes 600 msec per iteration? Not half second as you want. For that 500 msec value, use the "Wait until ms multiple" instead...


Are you sure? Whilst I agree that Wait Until Next ms Multiple might be a better choice for ensuring a regular loop time, the Waits appear to all be in parallel, so only the longest wait will do something to the outer loops iteration.


Hmm, i think the two waits are not parallel, so they will add up. But i will benchmark it, when i get to my PC 🙂

0 Kudos
Message 15 of 30
(1,285 Views)

@Blokk wrote:

Hmm, i think the two waits are not parallel, so they will add up. But i will benchmark it, when i get to my PC 🙂

Except for dataflow constraints, all waits run in parallel. There is a 100ms wait inside the sequence frame, a 500ms wait in the toplevel diagram of the big FOR loop. (And a 2ms wait inside the 40x FOR loop (80ms total) which makes absolutely no sense). If the others can finish in under 500ms, the total loop time will be 500ms. (See also this discussion)

Message 16 of 30
(1,277 Views)

Hi there.

I've timed it. It is pretty much 500ms. Definitely not 600. It's as near as dammit 5 seconds for 10.

 

0 Kudos
Message 17 of 30
(1,273 Views)

I've used your shift register instead. Much better and far simpler. Thank you for that.

0 Kudos
Message 18 of 30
(1,270 Views)

Superb. I did it by putting the two data streams into a cluster, then into a queue and pulling it out of the queue in the main GUI, as you suggested. Works nicely.

 

Thanks everyone, for the fantastic help.

 

Andrew

0 Kudos
Message 19 of 30
(1,269 Views)

If you want to do averaging, all you need is keep track of the accumulated sum in a second array. There is no need to jump through flaming hoops keeping track of all unaveraged data recorded so far and touch everything from scratch with each iteration. Also, I would keep the average as DBL, at least until the graph. Here is a simple example how it could look like (using simulated data, since I don't have your hardware).

 

 

Download All
0 Kudos
Message 20 of 30
(1,266 Views)