LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I dynamically insert items (data strings) into a table (Silver) from different cases within a state machine without deleting items already in the table?

How can I dynamically insert items (data strings) into a table (Silver) from different cases within a state machine without deleting items already in the table?

 

Thank You:)

0 Kudos
Message 1 of 13
(3,052 Views)

Insert into Array ?

The array that holds the data for the table should be held in a shift register ?

 

If those tips don't help, then please attach a VI so we can see what you are doing now.

0 Kudos
Message 2 of 13
(3,046 Views)

A table is just a String Array with a pretty front panel. Try the "Insert into Array" primitive.

 

But I am guessing 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 13
(3,043 Views)

I tried insert into array, however, I'm in a different case and use insert into array, it overrides everything in the table.  It's not indexing to the next row or column.

Is there a way to allocate items within the table in real time?

 

Thanks for the feedback,

0 Kudos
Message 4 of 13
(3,005 Views)

@floresma wrote:

I tried insert into array, however, I'm in a different case and use insert into array, it overrides everything in the table.  It's not indexing to the next row or column.

Is there a way to allocate items within the table in real time?

 

Thanks for the feedback,


You need to post your code, as you must be doing it wrong. 

 

But it really sounds like you do not have any shift registers to maintain the contents of the Array between iterations. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 13
(2,998 Views)

Here's a picture of a statemachine updating a table using insert into array.

table.PNG

Notice the shift registers on the for-loops.

I forgot to ask if you are keeping track of the row and column you are inserting to?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 13
(2,995 Views)

Thanks for the feedback...  However, I'm trying to find a way to do the same thing without using a shift register which makes the code messy.  I tried creating a sub vi that I can wire into but it also keeps overriding data...

 

Is there a way to do this without a shift register?

0 Kudos
Message 7 of 13
(2,963 Views)

Hi floresma,

 

do the same thing without using a shift register

Use a feedback node instead! 😄

 

which makes the code messy. 

I never heard of shift registers making code "messy"!

Why do you think so?

 

I tried creating a sub vi that I can wire into but it also keeps overriding data...

So the subVI needs to keep track of your data.

Sounds like a typical FGV (functional global variable) aka AE (action engine) approach - which heavily relies on using shift registers…

 

Did you do the basics course for LabVIEW beginners? Did you take the chapters on data handling in loops? I guess you should (re)take them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 13
(2,958 Views)

@floresma wrote:

Thanks for the feedback...  However, I'm trying to find a way to do the same thing without using a shift register which makes the code messy.  I tried creating a sub vi that I can wire into but it also keeps overriding data...

 

Is there a way to do this without a shift register?


Do you want pretty code or functional code?

 

Have you thought about using a "Functional Global" or "Action Engine"?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 13
(2,955 Views)

I'm not a fan of messy code, so if possible I prefer clean and functional:) 

 

I'm trying to eliminate the number of tunnels within the code.  I would prefer a subvi that can be placed in sections of the code.

0 Kudos
Message 10 of 13
(2,949 Views)