using fprintf to print same length values
5 次查看(过去 30 天)
显示 更早的评论
How can I use fprintf to print values with the same length (the number of digits after the pointer is changing based on the number of digits before the pointer)?
0.00000000
30.0000248
360.000305
0 个评论
回答(2 个)
Azzi Abdelmalek
2013-12-30
编辑:Azzi Abdelmalek
2013-12-30
b=360.000305
m=9 % fixed length
out=sprintf('%9.9f',b)
ii=numel(strfind(out,'.'))
out=out(1:m+ii)