LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert into array function does not enlarge array

Hi all,

I am facing a strange problem with the insert into array function or maybe I didn't understand the function right.

As you can see on the attached VI I want to add a 1D array on a existing row. Therefore, I read the row which I want to modify, add my 1D array so I get a larger array (still 1D) and insert it to the existing 2D array on the place where I read before.

 

My problem is that the array isn't growing when I insert the modified 1D array. I the example the modified 2D array should have a size of 2x7 but it is still 2x4.

 

Hope anyone can help me.

 

Ben

Stay Hungry, Stay Foolish
0 Kudos
Message 1 of 6
(2,453 Views)

Bump real post

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(2,452 Views)

The help clearly says that "This function resizes the array along only one dimension."

 

You are growing downward by inserting rows, thus you are not growing in the other dimension and the data is truncated.

 

If you want to grow in two dimensions, you need to add more code, e.g. insert a few dummy columns in the upper data trace before inserting the oversized row. Seems like a memory allocation nightmare. It would seem better to decide on a suitable size from the beginning, then operate in place.

 

 

(For simplicity, you could have attached an example VI containing default data in the controls and not containing complicated typedefs that we don't have)

0 Kudos
Message 3 of 6
(2,439 Views)

Okey, I see it's getting a little bit more complicate than I expected.

This really seems to become a memory nightmare.

 

Anyway, thank you again for your quick help.

 

Stay Hungry, Stay Foolish
0 Kudos
Message 4 of 6
(2,402 Views)

Here are some VIs I started and wanted to submit to OpenG. (Need to get around to that one of these days.) They should cover what you want.

 

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Download All
0 Kudos
Message 5 of 6
(2,381 Views)

Hi Mark,

if you publish these VIs, please make sure you saved them for previous LV versions.

 

Thanks

Stay Hungry, Stay Foolish
0 Kudos
Message 6 of 6
(2,358 Views)