あなたが文書化されていないMarkedClean
イベントを使用してこれを行うことができます。
残念ながら、Matlabはプロットが再描画されるたびにテキストを更新します(figure resizeなど)。そのため、リスナーを追加してその都度更新する必要があります。
function test
figure
[X,Y]=meshgrid(0:100,0:100);
Z=(X+Y.^2)*1e10;
[C,h]=contour(X,Y,Z);
h.ShowText='on';
% add a listener and call your new format function
addlistener(h,'MarkedClean',@(a,b)ReFormatText(a))
end
function ReFormatText(h)
% get all the text items from the contour
t = get(h,'TextPrims');
for ii=1:length(t)
% get the current value (Matlab changes this back when it
% redraws the plot)
v = str2double(get(t(ii),'String'));
% Update with the format you want - scientific for example
set(t(ii),'String',sprintf('%0.3e',v));
end
end
私はこの答えは非常に適しだろうと感じ[**文書化されていないが、実効状態DOC **](http://stackoverflow.com/documentation/matlab/2383/undocumented-features#t=201612020612571995264)、もう少し説明して、すてきなスクリーンショットが必要です。 – thewaywewalk
私は[example](http://stackoverflow.com/documentation/matlab/2383/undocumented-features/26052/contour-plots-customise-the-text-labels)を追加しました。 – matlabgui