How to display both values and text as output
이전 댓글 표시
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
2016년 2월 12일
How are the units stored? Do you have a separate string or cell array of strings?
답변 (1개)
w = 500 ;
R = 4.7 ;
fprintf('%f grams or %f k Ohms',w,R)
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!