How to display units with my answer?

prompt = 'Enter mass in pounds:';
x = input(prompt);
y = x*0.4536;
disp (y);
This is my current script and i want to have the answer display with 'kg' next to the answer and i cant figure out how to do it.

 採用された回答

Elysi Cochin
Elysi Cochin 2020 年 3 月 22 日
編集済み: Elysi Cochin 2020 年 3 月 22 日

1 投票

fprintf('%g kg\n', y)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by