06-30-2015 04:28 AM
Hello,
I have an array of two columns where each column is an array of 200K to 20M samples. I want to retrieve a 2D portion of this array starting at a specific index with a specific length.
So for example if the array is
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
and I want to obtain the subset
[2, 3]
[9, 8]
I would (using my logic and the documentation) use the "array subset" function with index1=2, length1=2, index2=2, length2=2. But this at the end only returns an empty array, with a size of 0x2 (??).
Any tips about what I´m doing wrong?
Solved! Go to Solution.
06-30-2015 04:58 AM - edited 06-30-2015 04:59 AM
Your X index (the first one) needs to be 0, not 2, since that's the first row. You're asking for the third row, which doesn't exist.
06-30-2015 05:12 AM
If i set index1 to 0 and leave the rest as 2 I get an empty array with size 0x0
06-30-2015 06:15 AM - edited 06-30-2015 06:17 AM
Then you should upload an example, because from your description it sounds like it should work.
Edit - looking at your original post, you say that you have two columns, but your example shows two rows. If you do actually have two columns, then the Y index needs to be 0, not the X index.
06-30-2015 07:37 AM
Here is the test VI I am using.
BTW I managed to get the results I wanted by creting a subVI with Array Indey and 1D Array subset funcitons (see attachment subset.jpg)
06-30-2015 08:03 AM
06-30-2015 08:05 AM
While this does what you want, you can do it much simpler. Try what tst suggested.
06-30-2015 08:08 AM - edited 06-30-2015 08:08 AM
Your example is also flawed.
06-30-2015 08:13 AM
I suspect your Encoder Signal input array was flawed. I ran your code, loading Encoder Array with 1,2,3, 4,5,6, 7,8,9 (3 by 3), then ran the snippet shown (I didn't wire in the default 0 for the two Index inputs), and got the 2 by 2 array 1,2, 4,5 as expected.
Bob Schor
06-30-2015 09:02 AM
I guess you are right that the input array must have some strange flaw. When I try with a short 2x10 array your solution works, but not with the default 2x350k array...very weird