Clear Filters
Clear Filters

How to write 2 didgits after decimal in text figure like given below

4 views (last 30 days)
how to print on a figure the text like
here p1 = 0.234567546485, k1 = 0.045677869
text(800,0.3,['\Delta = ' num2str(fprintf('%.2f',(k1*100))),newline,'S = ' num2str(fprintf('%.2f',(p1*100)))],...
I want o/p like
and in the next line below
Can anyone please help!

Accepted Answer

madhan ravi
madhan ravi on 7 Jan 2019
Edited: madhan ravi on 7 Jan 2019
a=['\Delta = ',sprintf('%.2f\n',(k1*100)),...
'S = ',sprintf('%.2f',(p1*100))];
Screen Shot 2019-01-07 at 1.59.19 PM.png

More Answers (0)


Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!