MATLAB: About fprintf.

fprintfprogramming

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!

Best Answer

Perhaps you wnat something like this:
x = 1.333333333333;
[a, b] = rat(x);
fprintf('%d/%d m^2\n', a, b)