1

プロットとそのカラーバーを削除したい (実際には、プロット内のすべてを削除したいのですが、継ぎ目はほとんど不可能です。軸を非表示にするか、プロットを完全に削除するを参照してください)

私はこれをします:

プロットで

hplot = pcolor(xAxis, yAxis, Data2D); 
hcb = colorbar;
handles.image.hColorbar = hcb;
handles.image.hplot = hplot;
guidata(handles.output,handles); 

後でGUIで:

if (isfield(handles,'image') && isfield(handles.image,'hplot'))
    if (handles.image.hplot~=0)
        delete(handles.image.hplot);
        delete(handles.image.hColorbar);
        handles.image.hplot = 0;
    end
end

無効なハンドルでは機能しdelete(handles.image.hplot)ますが、失敗handles.image.hColorbarします-なぜですか?

4

1 に答える 1