Ah, good job was just about to point out your edit.
When you first declared Matrix, you added 3 rows of vectors with 4 data each.
Actual presentation may look like this:
0 0 0 0
0 0 0 0
0 0 0 0
Then you "push_back" 10 rows from thereon; counting from 0.
0 ..
1 ..
2 ..
3 ..
4 ..
5 ..
6 .. //This is actually the 7th added row plus the 3 initial rows, making this the 10th row.
7 .. //Not displayed
8 .. //Not displayed
9 .. //Not displayed
As for your garbage data:
It's due to undefined behavior. The first 3 vectors have 4 declared data and garbage there after.
Either remove predefined vectors in matrix, or set their size to the appropriate size; 20 in your case.
Hope this helps.
Edit: the last three rows are also not shown. Possibly you may want to remove the predefined vector.
|
std::vector< std::vector< double > > Matrix;
|
Or limit the push_back or rows; -3 since you already have 3 rows preset.
Coding on browser; errors may arise.