Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

help with montage function

Asked by Jim O'Doherty

Jim O'Doherty (view profile)

on 1 Nov 2011


I have a stack of images which is 63x64x16 and is a uint16 class. Any idea how I would make a montage using the montage function? I keep getting an errorwith the color map:

??? Error using ==> imageDisplayValidateParams>validateCData at 114
Unsupported dimension
Error in ==> imageDisplayValidateParams at 31
common_args.CData = validateCData(common_args.CData,image_type);
Error in ==> imageDisplayParseInputs at 79
common_args = imageDisplayValidateParams(common_args);
Error in ==> imshow at 199
  [common_args,specific_args] = ...
Error in ==> montage at 139
    hh = imshow(bigImage,cmap);

Thanks in advance!


1 Comment

Wayne King

Wayne King (view profile)

on 1 Nov 2011

please show how you actually call montage()

Jim O'Doherty

Jim O'Doherty (view profile)

1 Answer

Answer by Amith Kamath

Amith Kamath (view profile)

on 2 Nov 2011
Accepted answer

From the help page for montage:

montage(X, map) displays all the frames of the indexed image array X, using the colormap map for all frames. X is an M-by-N-by-1-by-K array.

So I suppose you need to reshape your data into a 4D matrix, and then use montage on it with the appropriate colormap defined using map.

I ran montage on the 3D matrix and got the exact error, and hence I'm sure this will fix it!

1 Comment

Walter Roberson

Walter Roberson (view profile)

on 2 Nov 2011

I wonder how permute() compares in speed to reshape() for this purpose. Probably slower.

Amith Kamath

Amith Kamath (view profile)

Contact us