0

I have an array which is a 1X3 matrix, where: column 1 = x coordinate column 2 = y coordinate column 3 = direction of vector.

I am tracking a series of points along a path. At each point i want to store the x,y and direction back into the array, as a row.

So in the end, my array has grown vertically, with more and more rows that represents points along the path.

Im struggling to build this function inside a class. Help plz?

Xx

1

4 Answers 4

2

You're looking for the append function. But you should seriously take a look at numpy for using matrices in python

Sign up to request clarification or add additional context in comments.

Comments

0

Use .append('item-goes-here') to append.

Comments

0
In [1]: x = [1,2]

In [2]: y = [3,4]

In [3]: x+y
Out[3]: [1, 2, 3, 4]

Comments

0
# This is your matrix 1x3
matrix = []

# Use a list to store (x, y, direction)
data = [x, y, direction]

# To add data to the matrix use `append` on matrix list
matrix.append(point)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.