How to show exactly three digits after decimal in legend bar when the values are created by linespace in Matlab -


i have 1 stupid question. have range of value like:

n=linspace(1,2,15); 

now, want show these computed n value 3 digits after decimal in legend bar. have written code:

n_rounded = round(n * 1000) / 1000; 

and in figure set value yticklable:

set(h,'yticklabel', n_rounded); 

but value shown in legend bar didn't show 3 digits after decimal. example shows 1.5 instead of showing 1.500. need show 1.500 how can that?

br,

try set(h,'yticklabel', num2str(n_rounded, '%.3f\n'));

thanks man (comment deleted) line break.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -