what is wrong with fprintf
显示 更早的评论
why does not this function give the full text in fprintf:
function printem(a,b)
fprintf('the first number is %.lf and the second is %.lf\n',a,b)
end
what is displayed in matlab is
>> printem(3,5) the first number is>>
采纳的回答
更多回答(2 个)
Walter Roberson
2011-10-19
1 个投票
You appear to have used %.lf (lower-case L) instead of %.1f (digit one)
Harry MacDowel
2011-10-19
Try this
fprintf('the first number is %0.1f and the second is %0.1f\n',a,b)
类别
在 帮助中心 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!