LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble Iterating correctly through rows and columns with arrays

Hello! I am new to LV and working on a motion capture system project using the markers to find joint angles. To start I am trying to find the angle of the left wrist. My code posted below works to find angles, but my top for loop only goes through the first 9 columns when I need columns 87-99 (there are 151 in total) for the wrist data. I also need the code to go through each row of the specified columns. I want to be able to control what position it is reading from. I have attempted something that will allow me to index (picture below) but it creates an array rather than an element which doesn't connect with the joint angle math I have coded out within a loop. Does anyone know if there is a quick fix to this problem, or am I just using the wrong array function? Thank you.

mbel_0-1657730323764.png

 

Download All
0 Kudos
Message 1 of 8
(1,308 Views)

I think you simply need to go back to the tutorial and understand arrays.

 

If you want a single elements from a 2D array, you need to wire both indices, of course. If you leave one index unwired, you get a row or column.

 

No, your top loop does not only go though the first nine columns. Try to understand the decimate function.

0 Kudos
Message 2 of 8
(1,293 Views)

This wasn't very helpful. When i run my loop and compare my data it is only going through the first nine columns (first 3 body parts). I am not sure if you ran my code with the data, but when it stops it ends on the last row of the first 9 columns. I want my code to run similar to my top loop but be able to chose where it starts. That was all I was asking. I have read the help tabs and   the information documents on arrays and decimate with no further answer. If you aware of how to fix that problem it would be a lot more helpful then referring me to something i have already read.

0 Kudos
Message 3 of 8
(1,275 Views)

No, you get 9 arrays! If you only show one element in the array displays, that will not tell the entire story! Resize the container to see it all!

 

For each row, you have an array of [x1, y1, z1, x2, y2, z3, ....xN, yN, zN]

 

If you decimate that 9x, you get 9 1D arrays. containing elements as follows.

first array (labeled X1 in your program)

x1, x4, x7, ...

second array (labeled Y1):

y1, y4, y7, ...

 

etc.

0 Kudos
Message 4 of 8
(1,267 Views)

Hmm, try the concept in the attached VI. I think the wires are tangled up in the math logic but if you sort them back out It might be what you need. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 5 of 8
(1,258 Views)

I am aware of that, perhaps I didn't word it well enough for you. That still is not the question I was asking though. 

0 Kudos
Message 6 of 8
(1,252 Views)

Thank you! I will work with that now.

0 Kudos
Message 7 of 8
(1,251 Views)

@mbel wrote:

Thank you! I will work with that now.


👍 hope it works for you

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 8 of 8
(1,225 Views)