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

how to refresh a Matlab window and leaving it where it was in the Z-order

我在 Windows 7 上的脚本有多个 matlab 图形 (windows)。 当我周期性地重新显示视差图时,它总是把它带到另一个 windows 的前面。我想按 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 ); 
                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 ); 

与其每次使用 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