How to keep decimal float point only

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 件のコメント

JZ
JZ 2021 年 2 月 3 日
Thanks, 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 ExchangeDates 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