How to display units with my answer?

29 ビュー (過去 30 日間)
Holden Earl
Holden Earl 2020 年 3 月 22 日
コメント済み: Holden Earl 2020 年 3 月 22 日
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 日
fprintf('%g kg\n', y)
  1 件のコメント
Holden Earl
Holden Earl 2020 年 3 月 22 日
Thanks heaps!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHolidays / Seasons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by