Populating a tiledlayout vertically rather than horizontally

조회 수: 6 (최근 30일)
Jason
Jason 2025년 6월 5일
댓글: Star Strider 2025년 6월 5일
Hi, I have an 1D array of images in a cell array.
I want to montage them using my own settings, so I have been using tiledlayout.
I must have 3 rows, and my total number of images is always a multiple of 3.
n=app.ImCount.Value; % number of images in my cell array
tcl = tiledlayout(3,ceil(n/3),'TileSpacing','none','Padding','compact'); %tight
for i=1:n
IM=app.imgArray{i};
ROI=imcrop(IM,rect);
ax=nexttile(tcl);
myImagesc(app,ax,ROI); axis(ax,'image');
end
Say I have 12 images, rather than have the layout like this:
1 2 3 4
5 6 7 8
9 10 11 12
I want this, i.e. populating vertically
1 4 7 10
2 5 8 11
3 6 9 12
I thought there might have been an option in the tied layout but there is only a complete "vertical" arrangement possible.
So my idea next is to just index the images like 1,4,7,10,2,5,8,11 etc, but have no idea how to do this or whether this is a good way anyway
Thanks

채택된 답변

Star Strider
Star Strider 2025년 6월 5일
One option could be to use the TileIndexing property, and set it to 'columnmajor'.
  댓글 수: 6
Jason
Jason 2025년 6월 5일
Thats perfect, thankyou once again!
Star Strider
Star Strider 2025년 6월 5일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by