Simple Question: How do you change the number of decimals of a number inside of a legend so it has more decimal places? (Please view Attachment!)

22 ビュー (過去 30 日間)
%I want to display numbers such as .0254 in my legend as opposed to 0.2. How do I change that?
%Some of my Script below:
%2-D plot
if ic == 1
%Color and marker code for creating 2-D plots
Ncm = 6; scm = ['r-';'g:';'b-';'m:';'c-';'k:'];
h = zeros(Ny,1); st = zeros(Ny,9);
%Plot curves of T(x,y) for various y values
nfig = nfig+1; figure(nfig)
for j = 1:Ny
h(j) = plot(x,T(:,j),scm(j,:),'LineWidth',2); hold on
st(j,:) = sprintf('%5.1f = y',yy(j));
end
title('2-D Temperature Distribution of Long Wooden Beam')
grid,xlabel('X Values'),ylabel('Temperature (C)')
legend(h,char(st),'Location','SouthEast')
end

採用された回答

matt dash
matt dash 2014 年 10 月 27 日
Change %5.1 to %5.4
  2 件のコメント
matt dash
matt dash 2014 年 10 月 28 日
It does work. If you are having a problem implementing it, be specific about what the problem is...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by