Beginning Matlab simple text question
古いコメントを表示
I am using a textbox that will display updating information on a simple force calculator and I need to know what to add to this code to display the units at the end of the string (Newtons in this case). Thank you!
set(h,'string',num2str(ForceB)); %will display Force in Newtons
採用された回答
その他の回答 (1 件)
Image Analyst
2014 年 5 月 5 日
Try this:
% Create a string from the number, and append the word Newtons.
str = sprintf('%.3f Newtons', ForceB);
% Send the string to the static text label control.
set(h,'String',str); % Will display Force in Newtons
カテゴリ
ヘルプ センター および File Exchange で Scope Variables and Generate Names についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!