12-08-2012 05:33 PM
Hi there.
I have a 20x20 2D boolean array and need to convert this to a 40x40 2D boolean array. If the first element of the 20x20 array is a 1, the first two elements of the first and second line of the 40x40 array need to be a 1 as well.
Thanks in advance!
Solved! Go to Solution.
12-08-2012 06:09 PM - edited 12-08-2012 06:09 PM
This assumes a 20x20 input array size. To be more generic, you would use the size of input array as inputs to the Reshape Array.
12-08-2012 08:51 PM
Did you mean just the first element, or you want to scale all elements in the original array? If you want to effectively double the array size such that every previous element becomes 4 identical elements in the larger array, you need more code than that. One simple solution was recently posted: http://forums.ni.com/t5/LabVIEW/dublicate-array-elements/td-p/2215382
12-08-2012 08:57 PM
@jdepypere wrote:
I have a 20x20 2D boolean array and need to convert this to a 40x40 2D boolean array. If the first element of the 20x20 array is a 1, the first two elements of the first and second line of the 40x40 array need to be a 1 as well.
Boolean elements are either true of false, they are never 1.
You are leaving out a lot of scenarios. For example what should happen if the first element is FALSE?
Do the other elements matter too or can they be random?
Please be much more specific. 😄
12-08-2012 09:53 PM
Another guess: You want every element of the input array to be replaced by a 4-element (2x2) segment with all values equal to the input element and the 2x2 segments in the same relative postions as the elements in the input array.
Here is one way to do that.
Lynn
12-08-2012 10:44 PM - edited 12-08-2012 10:44 PM
Or similar to the other thread:
I made it smaller, but the code stays the same....
12-09-2012 06:18 AM
That's a very clean code, thanks! Works as expected 🙂