When indexing matrices in MATLAB, can I specify only the first or last n dimensions, and have all others dimensions "selected automatically"?
For example, I am writing a function which takes in an image, and displays it with imshow
, which can either display a 3-D color image (e.g 1024×768×3
) or a 2-D monochrome array (e.g 1024x768).
My function does not care about how many color channels the image has, imshow
will take care of that. All I want to do is pass parameters to select a single region:
imshow(frame(x1:x2, y1:y2, :))
What do I put in place of the last colon to say "include all the others dimensions"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…