How can I create a 3D imagesc plot?

17 views (last 30 days)
em95
em95 on 21 Dec 2017
Edited: Mohannad Ajamieh on 22 Jul 2022
A file output from a simulation I'm running is a 225x64 matrix data file made up of 15 2D 'slices' (each slice being 60x15), which combine to form a 3D structure (60x15x15). I've written a script which takes the 225x64 matrix data file and converts it to a 3D matrix (60x15x15), then plots each of the 15 'slices' as an imagesc plot (as shown in the picture). Is there a way for me to plot this as a 3D imagesc plot with visible selected internal slices, similar to that of the volumetric slice plot?
Volumetric Slice Plot: https://uk.mathworks.com/help/matlab/ref/slice.html
  1 Comment
Mohannad Ajamieh
Mohannad Ajamieh on 22 Jul 2022
Edited: Mohannad Ajamieh on 22 Jul 2022
try this code to generate 3d matrix.
names=dir('name of the file where your pic are saved\*.format of pics');
for i=1:size(names,1)
I(:,:,i)=imread(strcat('name of the file where your pic are saved\',names(i).name));
for j=0:size(names,1)
Img_3D=surface('XData',[0 15;0 15],'YData',[15 15;0 0],'ZData',[j j;j j], 'CData' ,flipdim(im2double(I(:,:,i)),i),'FaceColor','texturemap','EdgeColor','none');
colormap(gray)
end
end

Sign in to comment.

Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!