色を 4 次元として使用することも可能です (それが自分に似合うかどうかは好みの問題です)。
surf(X,Y,Z,V); #% 4th arg (V) is mapped onto the current colormap
好みに合わせてカラーマップを変更できます。
colorbar #% displays a colorbar legend showing the value-color mapping
編集:質問者は、単なる色ではなく、表示されていない配列のデータを正確に見たいと考えています。カスタムデータカーソル機能のお仕事です。以下では、純粋に匿名関数を使用してこれを実装しました。関数ファイル内でそれを行うと、もう少し簡単になります。
#% Step 0: create a function to index into an array...
#% returned by 'get' all in one step
#% The find(ismember... bit is so it returns an empty matrix...
#% if the index is out of bounds (if/else statements don't work...
#% in anonymous functions)
getel = @(x,i) x(find(ismember(1:numel(x),i)));
#% Step 1: create a custom data cursor function that takes...
#% the additional matrix as a parameter
myfunc = @(obj,event_obj,data) {...
['X: ' num2str(getel(get(event_obj,'position'),1))],...
['Y: ' num2str(getel(get(event_obj,'position'),2))],...
['Z: ' num2str(getel(get(event_obj,'position'),3))],...
['V: ' num2str(getel(data,get(event_obj,'dataindex')))] };
#% Step 2: get a handle to the datacursormode object for the figure
dcm_obj = datacursormode(gcf);
#% Step 3: enable the object
set(dcm_obj,'enable','on')
#% Step 4: set the custom function as the updatefcn, and give it the extra...
#% data to be displayed
set(dcm_obj,'UpdateFcn',{myfunc,V})
これで、ツールチップに余分なデータが表示されるはずです。プロット内のデータを変更した場合はStep 4
、新しいデータを関数に渡すために繰り返す必要があることに注意してください。