MATLAB: How to display a 3-D image in MATLAB using a function similar to IMAGESC for 2-D image

2-d2d3-d3dimageimagescMATLABmatrix

I have a 3-D matrix, called A, with M-by-N-by-P dimensions. For example, A is a 16-by-16-by-16 matrix and I am storing intensity values to some of its locations. For example, in A(1,16,16) which is row 1, column 16 and page 16, the intensity value is 128. Then, in A(16,16,1) it is 255, but not all the locations will have values. These locations will have a value of zero. I am trying to view this 3D matrix according to its intensity values. I would like to view this matrix as a 3-D image.

Best Answer

There is no MATLAB function that can directly display a 3-D matrix according to the intensity value.
To work around this issue, you can use the SCATTER3 function and use the indices of A as the X, Y, Z coordinates. Please see the attached example.
Related Question