about fprintf.
2 次查看(过去 30 天)
显示 更早的评论
hello, i would like to know how to display my final answer with sq. units. for example my area=4/3. i would like to know how to use fprintf so my final answer would become 4/3 sq. units. thank you!
2 个评论
Fangjun Jiang
2011-9-13
Are you asking to display a=4/3 as ratio of 4/3 instead of a=1.333, or are you asking to display whatever the square units? Do you want to display at command window, or to a file?
采纳的回答
Jan
2011-9-13
Perhaps you wnat something like this:
x = 1.333333333333;
[a, b] = rat(x);
fprintf('%d/%d m^2\n', a, b)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!