01-11-2010 03:54 PM
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!
Solved! Go to Solution.
01-11-2010 04:32 PM
oly wrote:
Any idea? Thank you!
Lots. Let's start with Index Array. Try that - it's not hard. Trust me.
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.
01-11-2010 08:52 PM
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!
01-11-2010 09:20 PM
01-11-2010 11:48 PM
01-12-2010 12:50 AM - edited 01-12-2010 12:50 AM
Here's a snippet usin OpenG tools to remove the correct columns:
Ton
01-12-2010 12:01 PM
Hi all,
Thank you! All the solutions you guys gave are working great!!!!