LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compound Arithmetic different array size

Solved!
Go to solution

Hi all,


I have two array with different size, 

 Array 1         Array 2

      1                0

      1                0 

      1                0

      1

 If compound arithmetic OR was performed on them, I got output 

1

1

1

 

 

 

Is there any way I can get 

1

1

1

1

 

Thank you.

 

 

 

 

Message Edited by oly on 01-19-2010 02:15 PM
0 Kudos
Message 1 of 6
(3,219 Views)

This is normal behavior. To have 1 1 1 1 you will have to compare the array sizes and append the good amount of 0 to the smallest array and then OR them.

 

Ben

0 Kudos
Message 2 of 6
(3,195 Views)
You could initilize the shortest arry to the same size as the longest. The default value would be zero for the cells that do not get written in.
Tim
GHSP
0 Kudos
Message 3 of 6
(3,190 Views)

Thank you for the ideas!

 

Array 2  is the output of some program, its size varies from 0 to hundred...

array 1 size is also variable, from 0 to 5...

 

so I am thinking somehow can I pad 0s after the smaller size array to make the sizes of them equal?

0 Kudos
Message 4 of 6
(3,170 Views)
something like this? if your array size changes all the time from each time the code is called. You could also use a case structure instead of 3 selectors
0 Kudos
Message 5 of 6
(3,163 Views)
Solution
Accepted by oly

Padding is most easily done using "reshape array". Here's some minimal code that pads the shorter array to the size of the longer one of the two.

 

Message Edited by altenbach on 01-19-2010 03:52 PM
Message 6 of 6
(3,152 Views)