Working with a Matrix of Vectors

I am trying to fill a matrix of Vectors. The Vectors are 100 wide and are based on Kinect Data. I want to create a matrix of 10 of these vectors, that has 1 column and 10 rows. I can’t get the syntax correct to push_back the vectors into matrix.

Here is what it looks like currently, but would like to be able to draw ten of these vectors and affect them.
https://vimeo.com/360436996

How is “mat” defined? You cannot push() to a matrix (vector of vectors), something like mat[x].push() should work

It is defined like this: vector<vector> mat;

I then tried the syntax you suggested but got the same error of “No matching member function for call to ‘push_back’” I am wondering if I am having some problem within the conditions of my for loops, or if the syntax still isn’t working correctly.

Thanks so much for the help

vector<vector> mat should not work. Try vector<vector<ofVec2>> mat.
https://www.techiedelight.com/vector-of-vector-cpp/

Anyway, what you call a “matrix” it ends up being a vector of vectors. I do not know what you want to do with your app but you may consider writing your own datatype using struct MyRow and then creating a vector containing your rows vector<myRow> mat

1 Like

Okay thanks so much I got that to work!