02-16-2024 09:02 AM
Is is correct that LabVIEW has no built in function to replace a subset of an 3D Array page?
Solved! Go to Solution.
02-16-2024 09:35 AM
To replace a 2D subset of a 3D array, you need to wire only one of the indexes; in this implementation, when you wire all three indices, it points to an element and not a 2D subset.
02-16-2024 10:04 AM
02-16-2024 10:58 AM
Another option (Replace a 3D array in a 3D array):
Also note that the 2D arrays can be transposed, making life "easier":
I'd think about it a while. Only if your data is really 3D (like a 3D voxel cloud or something), I'd consider 2D arrays in an array of classes (or clusters).
3D is too difficult for me. I'll use it if I have to (if the data is really 3D), but I try to avoid it.
I'd never put 2D tables in a 3D array, just because the size matches. If 1 measurement result is 2D, 2 measurements would fit a 3D array. Headaches for sure...
02-16-2024 07:41 PM
Would you find it counterintuitively, if one could wire a 2d array in the way I ask for in my initial post?
02-16-2024 08:05 PM
@Quiztus2 wrote:
Would you find it counterintuitively, if one could wire a 2d array in the way I ask for in my initial post?
If you have a 3d array and index into on all 3 axis (like 1, 1, 1) what size array/object do you expect to be located at the index(1, 1, 1)? A 2d array?
02-16-2024 08:40 PM
@Quiztus2 wrote:
Would you find it counterintuitively, if one could wire a 2d array in the way I ask for in my initial post?
Given a position and a 2D array, it can be inserted in three different planes. Obviously LabVIEW cannot make that decision because the information is insufficient.
02-19-2024 03:50 AM
If you really want to use 3D arrays (although this works for 2D arrays too), you might spent some time exploring the In Place Element Structure, esp. Index / Replace Element and Split / Replace Subset functions:
It never quite does what I expect from them (the replace can only replace scalars, the split doesn't actually return a 2D array when splitting a 3D array). These functions used to crash LabVIEW if the data sizes didn't match, but that's probably fixed.
A really annoying thing is that the dimension you set silently fall back to 0 if you wire the input with something bad. Fixing the problem doesn't restore the dimension you set. E.g. if you set the dim to 2, and insert a reverse array (obviously wrong for a 3D array), and remove it and rewire, all dims are back to 0. So, be warned and use CTRL+Z (and unit testing?)...