Hey MATLAB users,
I'm trying to show a numerical value with its unit in the command window. For example, 500 grams or 4.7k Ohms. Any suggestions?
Quick replies are much appreciated, thanks.

댓글 수: 1

Stephen23
Stephen23 2016년 2월 12일
How are the units stored? Do you have a separate string or cell array of strings?

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

답변 (1개)

KSSV
KSSV 2016년 2월 12일
편집: KSSV 2016년 2월 12일

1 개 추천

w = 500 ;
R = 4.7 ;
fprintf('%f grams or %f k Ohms',w,R)

카테고리

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

태그

질문:

2016년 2월 12일

편집:

2016년 2월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by