Control output resolution montage R2018b and later

16 views (last 30 days)
I'm using the montage function on two different versions of matlab: R2018b and R2017a. The function appears to function differently!
% im4d is a matrix of size 750 by 750 by 1 by 133
h = montage(im4d);
In R2017a, the montage produced is 'full resolution' - the size of h.CData is 9000 by 9000
In R2018b, the montage produced is 'low resolution' - the size of h.CData is 1200 by 1200
I noticed the imtile function in >=R2018b, but I'd like to use the same code for both/all recent-ish versions of Matlab. How do I do this? Is there a way to specify the 'output' size/res in montage?
Edit: I should add, I'd like to use this code in a function, so im4d could be any size. I was thinking that it might be possible to set the size of the parrent axes to have a size of what the montage would be: I'd assume that I'd need to create axes with a certain size before calling montage but how do I know what would be the right size?

Answers (1)

Raunak Gupta
Raunak Gupta on 19 Mar 2020
Hi,
The above functionality of Resolution change can be achieved using ‘ThumbnailSize property of montage function. Since this functionality was not available in R2017a the figure was plotted with all the data. Right now, if you don’t specify the ThumbnailSize, montage will resize the image to that of the size of screen.
Since you want predictability while plotting the montage, I suggest adding the ThumbnailSize. ThumbnailSize is the size of each image plotted from the image sequence. If you want custom size mention ThumbnailSize as a two element vector otherwise if you want aspect ratio of first image to be maintained then mentioned ThumbnailSize as
[number of pixel in one dimension, Inf]
This will rescale each image accordingly. Also, if you want full resolution image mention ThumnailSize as [ ]. Also Note that the montage arranges the number of images such that full figure nearly form a square. If you want custom shape, try setting the ‘Size’ field too.
Hope this clarify each of your doubt.

Categories

Find more on Install Products in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!