about fprintf.

조회 수: 4 (최근 30일)
Ejay Kasai
Ejay Kasai 2011년 9월 13일
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
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
Jan 2011년 9월 13일
What exactly are "sq. units"?

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
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)
  댓글 수: 2
Ejay Kasai
Ejay Kasai 2011년 9월 14일
but how do display it in decimal places?
Jan
Jan 2011년 9월 14일
fprintf('%f m^2\n', x)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by