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

11 views (last 30 days)
慶次郎 釜堀
慶次郎 釜堀 on 16 Nov 2022
Answered: Shunichi Kusano on 16 Nov 2022
%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内で更新されるようにしたいです。

Accepted Answer

Shunichi Kusano
Shunichi Kusano on 16 Nov 2022
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

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!