MATLAB: Imshow and montage with UIAxes

app designerimshowMATLABmontagemulti-plane image

Hi!
I'm trying to use the app designer to display an image from a stack of images in a TIFF file. The ~80 MB image is a
512 x 512 x 3 x 100 array of uint16.
In the command window, this works to show the Kth image in the stack:
imshow(rawframes(:,:,3,K))
When I try the same thing with UIAxes using variables that are app properties, however, I get an error. The app property app.V corresponds to a value between 1 and 100 that's set by a slider in the app. Its default is 1.
imshow(app.rawframes(:,:,3,app.V), 'Parent', app.UIAxes)
The error I get says:
Error using images.internal.createMontage>getOneImage (line 332)
Multi-plane image inputs must be RGB images of size MxNx3.
Error in images.internal.createMontage>getImages (line 238)
img = getOneImage(imgSource,useIndexedRead, idxs(k), cmap);
Error in images.internal.createMontage (line 66)
imageArray = getImages(imgSrc, thumbnailSize, borderSize, backgroundColor, indices, cmap, waitbarEnabled);
Error in montage (line 181)
[bigImage, cmap] = images.internal.createMontage(Isrc, thumbnailSize,...
Can anyone help? What's going on? I also tried montage and got the same error.
Thanks!

Best Answer

Never mind, it was really simple, and I figured it out. The value of app.V had to be rounded to the nearest integer before trying to use it to index into either imshow or montage. All good!