for文におけるfi​gure内の複数の画​像を更新されるように​したいです。

%Depth_Dataは3Dカメラデータ
for i = 1:number
A = Depth_Data(:,:,i);
A1 = imcrop(A,[55,0,150,120]);
B = medfilt3(A1);
figure,
subplot(3,2,1),mesh(A)
subplot(3,2,2),imagesc(A)
subplot(3,2,3),mesh(A1)
subplot(3,2,4),imagesc(A1)
subplot(3,2,5),mesh(B)
subplot(3,2,6),imagesc(B)
end
%この状態で実行すると、フレームごとにfigureが出てきてしまうので、固定のfigure内で更新されるようにしたいです。

 采纳的回答

Shunichi Kusano
Shunichi Kusano 2022-11-16
forループの外でfigureとsubplotで座標軸を用意しておき、forループの中では指定した座標軸に書き込むようにすると上書きとなります。
figure,
ax1 = subplot(3,2,1);
ax2 = subplot(3,2,2);
ax3 = subplot(3,2,3);
ax4 = subplot(3,2,4);
ax5 = subplot(3,2,5);
ax6 = subplot(3,2,6);
for i = 1:number
A = Depth_Data(:,:,i);
A1 = imcrop(A,[55,0,150,120]);
B = medfilt3(A1);
mesh(ax1,A)
imagesc(ax2,A)
mesh(ax3,A1)
imagesc(ax4,A1)
mesh(ax5,B)
imagesc(ax6,B)
end

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 対話型コントロールとコールバック 的更多信息

产品

版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!