Universal Robots Forum

Feature Request: URScript Matrix Element Indexing Improvement

URScript Example:

a = [[1, 2], [3, 4]]

b = a[0,0]

c = a[0]

the result of b is 1 as expected

the expected result of c is the first vector in a, [1,2], but instead is:

'Index out of range'

Could we access a multidimensional element using one of the following?

c = a[0,]
c = a[0]

What were the results you expected to receive for b and c?

Thanks Matt, just updated the first post. Looking to get the first vector ([1,2]) like you would get the first pose in a list of poses.

What is the language you used for this example? It looks like it is python

The issue I see is with array b not c. to get a specific value in python, you have to declare as b=a[0][0], not as a[0,0].

The array c might be initialized to a size 1 or 0. I would check for an issue on your code because the ‘Index out of range’ is an error message from the python side.

check this example:

Ooh appreciate your response but this in URScript. Believe me I would also like slicing and negative indexing like in python but I’ll settle for the basic features for now haha.

Give it a try using the new matrix/multidimensional array functionality in SW 5.9 and see what you get.

Derp, I completely skipped over the part where you said URScript on the first post. My bad, :smile:.