I could not find any answer about this. So I have a float number (a=323.153), I wanna output look like this with keeping decimal point only:
>> a=323.
What format shall I use?
Thanks.

 채택된 답변

Robert U
Robert U 2021년 2월 3일

0 개 추천

If it is just for display you can specify the output format in fprintf.
a = 323.153;
fprintf('<< a = %.0f.\n',a)
output:
<< a = 323.
Kind regards,
Robert

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 2월 3일

0 개 추천

https://www.mathworks.com/help/matlab/ref/fix.html

댓글 수: 2

JZ
JZ 2021년 2월 3일
Thanks, Walter.
It's not exactly what I need. I need output with a dot, so (>>a=323.).
Alex Alex
Alex Alex 2021년 2월 3일
Convert to string format and add point manually?

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

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

릴리스

R2017a

태그

질문:

JZ
2021년 2월 3일

댓글:

JZ
2021년 2월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by