如何刷新Matlab窗口并将其保留在Z顺序中的位置

时间:2015-08-19 00:45:50

标签: windows matlab matlab-figure

我在Windows 7上的脚本有多个matlab数字(窗口)。 当我定期重新显示视差图时,它总是将它带到其他窗口的前面。我想把它放在原处,按照Z顺序。

                if isempty( disparity_map_figure)   
                    disparity_map_figure = figure('Name', 'DISPARITY MAP');
                else
                    figure( disparity_map_figure );
                end
                imshow(disparity_map, DisparityRange, 'colormap', jet ); 

2 个答案:

答案 0 :(得分:4)

不是每次使用imshow重新创建图像对象,而是第一次获取imshow创建的图像对象的句柄,然后仅使用新的'CData'属性更新值。这将修改图像而不会影响图形的z顺序。

以下是一个例子:

f = figure; %// create figure
data = rand(200,300); %// initial data
figure(f); %// make figure current
h = imshow(data); %// create image in that figure with initial data
%// Place here code that sets figure z-order; for example by creating other figures
for n = 1:10
    pause(.1) %// include a pause for better visualization
    data = rand(200,300); %// create new data
    set(h, 'CData', data); %// update image data without affecting figure z-order
end

答案 1 :(得分:-2)

                if isempty( disparity_map_figure)   
                    disparity_map_figure = figure('Name', 'DISPARITY MAP');
                else
                    set(groot,'CurrentFigure',disparity_map_figure);

                    %figure( disparity_map_figure );
                end
                imshow(disparity_map, DisparityRange, 'colormap', jet );