필터 지우기
필터 지우기

how to display multiple images?

조회 수: 1 (최근 30일)
kitty varghese
kitty varghese 2017년 9월 12일
댓글: kitty varghese 2017년 10월 27일
if true
A = rand(361,285);
B = reshape(A,19,19,19,15);
end
I want to display each 19*19 into an image into 19*15 subplots under one figure.
  댓글 수: 1
José-Luis
José-Luis 2017년 9월 12일
285 subplots in one figure? That ain't gonna be pretty.
What part of the subplot() documentation did you not understand when you read it?

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2017년 9월 12일
편집: KSSV 2017년 9월 12일
Optioin 1: Using subplot
A = rand(361,285);
B = reshape(A,19,19,19,15);
%%Save each 19*19 matrix into image
for i = 1:19
for j = 1:15
idx = sub2ind([15,19],j,i) ;
subplot(19,15,idx) ;
imshow(B(:,:,i,j))
drawnow
end
end
Option 2: Using montage
A = rand(361,285);
B = reshape(A,19,19,19,15);
%%Save each 19*19 matrix into image
fnames = cell(1,19*15) ;
for i = 1:19
for j = 1:15
idx = sub2ind([15,19],j,i) ;
fnames{idx} = strcat(num2str(idx),'.jpeg') ;
imwrite(B(:,:,i,j),fnames{idx}) ;
end
end
montage(fnames, 'Size', [19, 15]);
  댓글 수: 1
kitty varghese
kitty varghese 2017년 10월 27일
what changes should i make if i need to montage the images using the first code?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by