# MATLAB: Indexing the answer into matrix form

MATLAB and Simulink Student Suitematrixmatrix manipulation

how do i display my answer that is x0 (which is a 3×1 matrix) into a matrix where the rows are my x0 and the columns are my i,(number of iteration)

format long gfor i = 1 : 10    %x0 = some calculation involving values indexed at i that gives a vector of length 3    x0 = [sin(2*pi*i+i/2), -cos(2*pi*i-i/2), cos(2*pi*i+i/2)*sin(2*pi*i-i/2)];    results(:,i) = x0;enddisp(results)  Columns 1 through 6

0.479425538604203         0.841470984807896         0.997494986604054         0.909297426825682         0.598472144103957         0.141120008059869
-0.877582561890373        -0.540302305868139       -0.0707372016677022         0.416146836547143         0.801143615546934         0.989992496600446
-0.420735492403949        -0.454648713412841       -0.0705600040299343         0.378401247653963         0.479462137331568         0.139707749099461

Columns 7 through 10

-0.350783227689618        -0.756802495307927        -0.977530117665097        -0.958924274663139
0.936456687290796          0.65364362086361         0.210795799430778        -0.283662185463229
-0.328493299359396        -0.494679123311693         -0.20605924262088         0.272010555444682t = array2table(results, 'rownames', {'x', 'y', 'z'}, 'VariableNames', "t="+string(1:size(results,2)))t = 3x10 table                t=1                   t=2                    t=3                   t=4                  t=5                  t=6                  t=7                   t=8                   t=9                   t=10
__________________    __________________    ___________________    _________________    _________________    _________________    __________________    __________________    __________________    __________________

x     0.479425538604203     0.841470984807896      0.997494986604054    0.909297426825682    0.598472144103957    0.141120008059869    -0.350783227689618    -0.756802495307927    -0.977530117665097    -0.958924274663139
y    -0.877582561890373    -0.540302305868139    -0.0707372016677022    0.416146836547143    0.801143615546934    0.989992496600446     0.936456687290796      0.65364362086361     0.210795799430778    -0.283662185463229
z    -0.420735492403949    -0.454648713412841    -0.0705600040299343    0.378401247653963    0.479462137331568    0.139707749099461    -0.328493299359396    -0.494679123311693     -0.20605924262088     0.272010555444682