Displaying data side by side using fprintf
显示 更早的评论
Two questions in one day, I must be pretty bad at this. Anyways after getting past my first problem I now have to display two arrays side by side like a table. Normally I'd just combine them and print them out at once or something but the different columns have to be displayed with different significant figures.
I've tried this:
fprintf('%.2f %.3f\n', velocity,distance)
but it turns out way wrong.
The two vectors are:
velocity
170
290
-130
-70
-185
-220
200
290
270
200
300
-30
650
150
500
920
450
500
500
960
500
850
800
1090
and distance
0.0320
0.0340
0.2140
0.2630
0.2750
0.2750
0.4500
0.5000
0.5000
0.6300
0.8000
0.9000
0.9000
0.9000
0.9000
1.0000
1.1000
1.1000
1.4000
1.7000
2.0000
2.0000
2.0000
2.0000
All I need is a way to get them next to each other. I can figure out the significant figures and spacing myself.
Thanks alot.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!