How to display units with my answer?

조회 수: 37 (최근 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)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by