LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest way to add a dimension to an array and then fill the added dimension with a specific number

What would be the fastest way to add a dimension to an array and then fill the added dimension with a specific number?
 
 
0 Kudos
Message 1 of 3
(2,289 Views)
I should be more clear about what I'm trying to do here since I'm terrible with array nomenclature...
 
I have a 2d array such as:
 
0 5 1
1 3 2
2 4 3
3 5 4
4 6 3
5 7 2
 
I would like to add a column to this array and place the same number on all rows so the final array looks like:
 
0 5 1 4
1 3 2 4
2 4 3 4
3 5 4 4
4 6 3 4
5 7 2 4
 
Thanks,

David
0 Kudos
Message 2 of 3
(2,285 Views)
You are not really adding a dimension, because the array is 2D before and after the operation.
 
In the most general case where the colum and row sizes will significantly increase, I would initialize an array of the final size with the desired filler element, then use replace array subset to fill in the original array.
 
If you just want to add a single column for example, it might be easier to use e.g. "insert into array".
 
Do you have a more typical example of the sizes involved?

Message Edited by altenbach on 06-04-2007 04:37 PM

Message 3 of 3
(2,281 Views)