LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store new values of array in new row while old ones remain in previous rows

Solved!
Go to solution

@Bert_Hannon wrote:

I indeed forgot to implement a Wait. But what do you mean with overcomplicating things? I don't think the event structure makes it that less complicated.


1.  The event structure doesn't poll (ie burn up CPU)

2.  The event structure is less complicated.  I totally misinterpreted your code at first glance.  The extra loop was throwing me for a...loop.  I see an event structure and I know immediately what is causing what.

3.  The event structure is a lot more expandable.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 11 of 19
(837 Views)

If you simply remove the inner loop and place a wait in the outer loop, you have basically the same functionality with half the number of loops and also eliminate the boolean operation. 🙂

 

 

0 Kudos
Message 12 of 19
(835 Views)

It's indeed more extendable, but I'm not convinced that it's less complicated... However, that's ofcourse a subjective question. Thanks for the info.

0 Kudos
Message 13 of 19
(833 Views)

But yes, I would definitely use an event structure here. However, often the new data comes from an instrument and something else is better.

 

In the above example with events, I would also place the array indicator to the left of the event structure so all stale data gets cleared immediately when the program is started. Else you see garbage until the firs row is added.

Message 14 of 19
(830 Views)

@altenbach wrote:

If you simply remove the inner loop and place a wait in the outer loop, you have basically the same functionality with half the number of loops and also eliminate the boolean operation. 🙂


I see Smiley Happy. Thanks!

0 Kudos
Message 15 of 19
(828 Views)

Can you attach that VI where you have used event structure?


0 Kudos
Message 16 of 19
(826 Views)

@NapDynamite wrote:

Can you attach that VI where you have used event structure?


I actually saved that as a snippet.  You can save off that png file and then drag it onto a block diagram and you will automagically have code.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 17 of 19
(818 Views)

@NapDynamite wrote:

I want 4 number of rows.


Since you also have four columns, the final size of the array is fixed and known from the start. For better memory efficiency, it would bet better to initilalize the 4x4 array from the beginning (e.g. containing all NaN) and then replace rows as you go, keeping the size constant.

 

(It won't really make a difference here because the array is so small, but once you operate on much larger datasets, it will be many orders of magnitude more efficient.)

0 Kudos
Message 18 of 19
(810 Views)

Thanks altan. Thanks you Bert as well. You both have been really helpful. 
Smiley Happy

Looking forward for more help next time 


0 Kudos
Message 19 of 19
(795 Views)