Can you use the 'format long' command in the 'fprintf' command?
显示 更早的评论
I would like to have variable 'x' formated using the 'format long' command when it is printed using fprintf. However, I am unable to place it between the % and f values of ('%f',x) since 'format long' begins with an f. I have tried using '.15' between % and f, however, the output values are not aligned when the numbers infront of the decimal place increase (see below). Can 'format long' be used in fprintf? If not, how can I keep the numbers in front of the decimal place the same length (in this example, '08' for the last three entries)?
sqrt of a (x) error(e) iteration(s)
32.500000000000000 9.923e+02 1
17.234615384615385 2.330e+02 2
10.474036101145005 4.571e+01 3
8.292191785986859 4.760e+00 4
8.005147977880979 8.239e-02 5
8.000001655289593 2.648e-05 6
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Structures 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!