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.
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.
HI Terry, thank u for the support. I’ve tried to add this script in polyscope, but it failed the execution.
I’ve an error with temp = mat[i] with the following message: the variable Matrix is not indexable!
Ooh, yea you’re going to hate this more but what we actually did is used the tried and tested @mbush technique and used another language to generate this:
def get_element(mat, index, size):
if size == 1:
temp = 0
elif size == 2:
temp = [0, 0]
end # continue this trend
count = 0
while count < size:
temp[size] = mat[index, size]
count = count + 1
end
end
matrix = [[0, 1], [2,3]]
element_size = 2
# Output is [2, 3]
row = get_element(matrix, 1, element_size)