I have a 2400x2400 matrix that I would like to use as a mask for each layer of a 2400x2400x46 matrix. Since the matrix dimensions are not equal, I cannot do so by simply multiplying the mask matrix by the larger matrix. How might I do this?

1 次查看(过去 30 天)
I have a 2400x2400 matrix that I would like to use as a mask for each layer of a 2400x2400x46 matrix. Since the matrix dimensions are not equal, I cannot do so by simply multiplying the mask matrix by the larger matrix. How might I do this? The end goal is to have a 2400x2400x46 matrix that has "NaN" for all "NaN" values in the mask matrix.
Thank you.

采纳的回答

Image Analyst
Image Analyst 2012-11-29
% Mask the image.
maskedHyperSpectralImage = bsxfun(@times, HyperSpectralImage, cast(mask,class(HyperSpectralImage)));
Note: the above is all one line of code.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by