LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert 1D array into 3D array

I need to insert a 1D array into a 3D array as a new row into a
specific page. Since the Insert Into Array will only insert 2D into
3D, I am using the Build Array to turn the 1D into a 2D and then using
the Insert Into Array. My problem is that it inserts it as a new page
rather than a row on a page. Does anyone know how to insert a 1D
array into a 3D array as a new row in a certain page?
0 Kudos
Message 1 of 4
(5,569 Views)
The problem is that arrays by definition have to be rectangular (or cubic for a 3D array?). In other words, each page has to have the same number of rows and columns. To do what you asked you have to append a new row to each page in turn, inserting the real data where you want it. Unlike when appending a 1D array to a 2D array, LV will not automatically resize things so all the pages match, it just doesn't do it.

If you are really wanting to append a row to just one page, it sounds like you might not want a 3D array in the first place. Creating a 1D array of clusters where the cluster only contains a 2D array lets each page be a different size... And might actually be easier to work with...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 4
(5,569 Views)
I am having the same problem as well. I used to have a cluster of tables (i.e. cluster of 2D arrays), but with so many case statements, I started to drown in a sea of bundle/unbundles. The other problem is that labview will not have an array of tables, because a 1D array of 2D tables is just a 3D array.

My new problem is just like the one stated above. I need to insert 2D arrays of unknown size into a 3D array of size = 4. Labview won't let me insert into anything past page zero.

Seems to be pretty silly as well. You're damned if you do and damned if you don't. Labview should be able to handle this unless there's some programming law I'm not familiar with.
0 Kudos
Message 3 of 4
(5,569 Views)
> I started to drown in a sea of bundle/unbundles. The other problem is
> that labview will not have an array of tables, because a 1D array of
> 2D tables is just a 3D array.
>

Actually, a 1D array of 2D array can either be made into a 3D array,
which as pointed out in the other post must be square, true, whatever
you want to call it. But each of the 2D arrays will be padded out to be
the same size as they become pages in the 3D array.

The other option is to make a 1D array of cluster of 2D array. This
allows for each element to be a different size, even empty. It just
means that you have a single unbundle to pull the 2D out of the 1D.

> My new problem is just like the one stated above. I need to insert 2D
> arrays of unknown
size into a 3D array of size = 4. Labview won't let
> me insert into anything past page zero.

To select the page, you wire a numeric to the top index. Leave the
others alone. To affect rows, use another index, columns, the final index.
>
> Seems to be pretty silly as well. You're damned if you do and damned
> if you don't. Labview should be able to handle this unless there's
> some programming law I'm not familiar with.

I'm still unclear if you really intend to insert or replace. If you
want the array to be a different size, use the insert node. If you want
to change elements without affecting the size, use replace.

If you have further questions, please be more specific about what you
are intending to do and what it does instead, or attach a picture.

Greg McKaskle
0 Kudos
Message 4 of 4
(5,569 Views)