MATLAB: Matlab results grouped question

math results

How can i have in results all the first results and all the second results regrouped?
0.3151
-0.3904
0.3412
-0.3416
0.3581
-0.2836

Best Answer

Hi,
i assume you have the results in a form of:
res1 = [0.3151; -0.3904]
res2 = [0.3412; -0.3416]
res3 = [0.3581; -0.2836]
which looks like in your question:
res1 =
0.315100000000000
-0.390400000000000
res2 =
0.341200000000000
-0.341600000000000
res3 =
0.358100000000000
-0.283600000000000
Then you can do:
res = reshape([res1; res2; res3],2,[]);
group1 = res(1,:)'
group2 = res(2,:)'
which results in:
group1 =
0.315100000000000
0.341200000000000
0.358100000000000
group2 =
-0.390400000000000
-0.341600000000000
-0.283600000000000
Check the reshape function - it is very useful.
Best regards
Stephan