I am trying to print comparative columns to compare elements with the same index of two or three different vectors. I will illustrate my question with the following example
>> a = [5.47758 7.46578 3.45323]
a =
5.4776 7.4658 3.4532
>> b = [5.65432 4.45678 2.34789]
b =
5.6543 4.4568 2.3479
Now if i write
>> sprintf('%.2f %.2f\n',a, b)
I get the following response from Matlab
ans =
5.48 7.47
3.45 5.65
4.46 2.35`
But how I would like to see this presentation of meanings is
ans =
5.48 5.65
7.47 4.46
3.45 2.35
How can I use the sprintf function (or another function or method) to get the above view? Thank.
source
share