Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way convert Boolean 2d array to 1d boolean array

Hello, presently doing one project I need help(How to convert Boolean 2d array to 1d boolean array?

0 Kudos
Message 1 of 6
(811 Views)

As this is a basic LabVIEW question I would post it in the LabVIEW forum as you will get a quicker response.

 

Though, here is what I believe you are looking for.  This will also work with a 3D to 1D array also just by changing the input array size.

DavidWilt_0-1610368664386.png     DavidWilt_1-1610368705429.png

David Wilt
The New Standard LLC
0 Kudos
Message 2 of 6
(786 Views)

@DavidWilt wrote:

Though, here is what I believe you are looking for.  This will also work with a 3D to 1D array also just by changing the input array size.

DavidWilt_0-1610368664386.png     DavidWilt_1-1610368705429.png


Slight edit here.  You don't actually need the FOR loop.  You can just use Multiply Array Elements (in the Numeric palette) instead.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(782 Views)

@crossrulz wrote:


Slight edit here.  You don't actually need the FOR loop.  You can just use Multiply Array Elements (in the Numeric palette) instead.


Thanks, I did a quick look for that function and did not see one so used the For Loop.  Learn something new every day.

David Wilt
The New Standard LLC
0 Kudos
Message 4 of 6
(778 Views)

A "boolean array" is green, not orange, so you need to read between the lines....

 

Still the shown solution should work for all datatypes. 😉

 

You could even make it into a malleable VI (*.vim) so it works for inputs of any number of dimensions and datatypes (within reason!), always resulting in a 1D array.

 

Another option would be to use a FOR loop and concatenating tunnel. (Same result, but 2D to 1D only).

 

altenbach_0-1610401064797.png

 

0 Kudos
Message 5 of 6
(754 Views)

I completed missed that it was a boolean array.  I used a double.  Wow I guess it was too early this morning and I should never try to answer questions before my coffee.

David Wilt
The New Standard LLC
0 Kudos
Message 6 of 6
(750 Views)