how to calculate %?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Minh
am 21 Sep. 2022
Kommentiert: Image Analyst
am 22 Sep. 2022
I need to calculate % by dozens of formulas x = (x% 100) / 10 but in MATLAB behind % is a comment?
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 21 Sep. 2022
Try this:
x = 23;
str = sprintf('%3.3d', x)
fprintf("hundreds :%s\n", str(1));
fprintf(" tens :%s\n", str(2));
fprintf(" units :%s\n", str(3));
x = 456
str = sprintf('%3.3d', x)
fprintf("hundreds :%s\n", str(1));
fprintf(" tens :%s\n", str(2));
fprintf(" units :%s\n", str(3));
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!