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.