Display multiple imagesc's in separate figure windows

19 次查看(过去 30 天)
I am looking to use the imagesc command to display an image of a matrix. I'm looking to do this multiple times but each new iteration overrides the last.
Here is some sample code to get the idea.
for i=1:5 % Five iterations
matrix=eye(i); % Creates some matrix (identity for example)
imagesc(matrix); % Displays matrix as an image
% Image gets overridden (only 5x5 identity matrix displays at end)
end
My hope is that I can have each image open in separate windows.

采纳的回答

Mario Malic
Mario Malic 2021-2-20
Hello,
if you don't supply the axes handle to plot on, it will use gca axes to plot on. If there are no axes to plot on, gca will create new one.
ax(1) = axes(figure(1))
ax(2) = axes(figure(2))
% and so on
Replace your imagesc line with this one
imagesc(ax(i), matrix);
However, having 5 figures open is not the tidiest way to do it, consider using subplots.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by