Hello everyone:

I am a C++ newbie. I have used Matlab to fill the rows or columns of a matrix with values from a vector and I'm wondering how to do the same thing in C++...

I have written code that puts new values in a vector. This happens in a "for" loop. Each iteration of the loop represents a new time. So for each time/loop, I have a new set of values in the vector that I need to store.

I would like to take the vector and store it as a column of a matrix outside the loop. Can anyone suggest how to do this? The reason I want to do this is that I want to plot the values from each vector over time. I think I could "return" the vector at the end of each loop and maybe save it, but I don't know how to make a matrix that grows during looping (has new columns added).

I would be grateful for any help or advice.