Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 通过单击图形中的子地块来删除该子地块。图形用户界面_Matlab_Events_Matlab Figure_Subplot - Fatal编程技术网

Matlab 通过单击图形中的子地块来删除该子地块。图形用户界面

Matlab 通过单击图形中的子地块来删除该子地块。图形用户界面,matlab,events,matlab-figure,subplot,Matlab,Events,Matlab Figure,Subplot,我有这个图。当用户点击一个子图时,图像将显示在不同的图中。我希望当用户右键点击一个子图时,这个子图中的图像将被删除 可能吗?如果是,怎么办 注:这里是我的previus问题,关于点击并以不同的图形显示图像 通过对您提到的问题的解决方案进行一些小的更改,可以很容易地做到这一点 以下代码允许您左键单击图像以在新地物窗口中获取图像,右键单击图像以将其从子地块中删除: function interactivePlot list_of_images = {rand(5), rand(10), ra

我有这个图。当用户点击一个子图时,图像将显示在不同的图中。我希望当用户右键点击一个子图时,这个子图中的图像将被删除

可能吗?如果是,怎么办

注:这里是我的previus问题,关于点击并以不同的图形显示图像


通过对您提到的问题的解决方案进行一些小的更改,可以很容易地做到这一点

以下代码允许您左键单击图像以在新地物窗口中获取图像,右键单击图像以将其从子地块中删除:

function interactivePlot
    list_of_images = {rand(5), rand(10), rand(50), rand(100)};

    for ii = 1:length(list_of_images)
        subplot(2,2,ii);
        a = imagesc(list_of_images{ii}, 'ButtonDownFcn', @newFigure1);
        set(a,'UserData',ii);
    end
end


function newFigure1(h1,~)
    switch get(gcf,'SelectionType')
        case 'normal'
            figure();
            data = get(h1, 'CData');
            imagesc(data);
        case 'alt'
            delete(get(h1,'Parent'));
    end
end