LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to return subset of an array based condition bits

Solved!
Go to solution

Hi,

 

I have a question about how to get subset of array based on condition bits...

For example, if I got one 4x4 2D data array from DAQ system,

 Array 1:

 

1 2 3 4

1 2 3 4

1 2 3 4

1 2 3 4

 

and one 1D array indicating the conditions of each channel... 

Array 2:

 

1

0

1

0

 

The function I want to realize is to pick up the data only from the channels whose condition bits are 1. For the example above, I only want to pick up data from channel 0 and channel 2. Any idea? Thank you!

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 7
(3,284 Views)

oly wrote:
Any idea? Thank you!

Lots. Let's start with Index Array. Try that - it's not hard. Trust me. Smiley Wink

 

Of course, there's also an OpenG VI that will do this. 

 

And if you wanted to be obscene you could use the Select Signals Express VI. 

Message 2 of 7
(3,260 Views)

Thanks for your suggestion! smercurio_fc!

 

I was using delete from array function before, which made the program a little bit complicated...

 

For the example above, 

 

1 2 3 4

1 2 3 4

1 2 3 4

1 2 3 4 

 

With condition bits, 

 

1

0

1

0

 

Colume 1 and 3 need to be deleted.

 

After column 1 was deleted, the data array changed into

1 3 4

1 3 4

1 3 4

1 3 4  

 

Now column 2 need to be deleted, which is the original column 3. I guess I complicated the program. 

 

One more thing is that the size of the original array is not fixed.

 

I will  try the index array function and post the code.

 

Any other idea how to realize this a little bit quick? I mean if the original array is 500X400, I guess it will take long time for the this to complete...Thank you!

 


 

 

0 Kudos
Message 3 of 7
(3,240 Views)
Delete the higher number columns first.
0 Kudos
Message 4 of 7
(3,229 Views)
Solution
Accepted by topic author oly

Hi oly,

 Check this VI...

 

 

 

Thanks and regards,

srikrishnaNF

Regards,
Srikrishna


Message 5 of 7
(3,223 Views)

Here's a snippet usin OpenG tools to remove the correct columns:

 

 

Ton

Message Edited by TCPlomp on 12-01-2010 07:50 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 7
(3,217 Views)

Hi all,

 

Thank you! All the solutions you guys gave are working great!!!!

0 Kudos
Message 7 of 7
(3,191 Views)