View Single Post
gnurf is offline
Sep7-09, 11:16 AM
P: 330
I have n=1:100 three dimensional row vectors with components x(n), y(n), and z(n), representing a vector at hundred different instances of time. I would like to create a 100 row by 3 column matrix, A(n), that would contain these vectors, such that a call of, e.g., A(4) would return the vector with components x(4) y(4) z(4).

Apparently, I suck at using both Matlab and google, so my question is: How is this done in Matlab?

My futile attempt so far looks like this:
for n = 1:100
    i(n) = ...
    j(n) = ...
    k(n) = ...
    H = [i(n), j(n), k(n)];
Which of course only leaves me with H=H(100)....

Edit 2:

Adding R = [R;H]; to the line below H = .... and simply calling R(n,:) for the nth vector in question seems to do the trick, albeit not exactly the way I wanted. Anyway, feel free to contact me for more groundbreaking problem-solving with Matlab...
Phys.Org News Partner Mathematics news on
Math modeling handbook now available
Hyperbolic homogeneous polynomials, oh my!
Researchers help Boston Marathon organizers plan for 2014 race