slice: plot complete slices
Afficher commentaires plus anciens
Hi there! I want to use the slice function to plot slices of a volume:
testVol = cat(3,magic(5),magic(5)+3,magic(5)+6);
figure; slice(testVol,[],[],1:3)
Now the result isn't 3 planes of 5 x 5, but instead 3 planes of 4 x 4:

I have tried specifying the coordinates for X, Y and Z like so:
[X,Y,Z] = meshgrid(1:5,1:5,1:3);
figure; slice(X,Y,Z,testVol,[],[],1:3)
But it seems I am not understanding what these coordinates mean. I thought they'd sample the volume at the requested points, but obviously that is not what is happening.
Any help would be much appreciated!
EDIT: I found that this is a problem of surface. So plotting a 2x2 matrix using surface like so:
surface([1 2; 1 2],[1 1; 2 2],[1 1; 1 1],[1 2; 3 1000])
... only gives you back a 1x1 tile, which is entry (1,1), so the top left one (1 in this case). Would still be very happy if someone could show me how to view a 2x2 matrix in surface as a 2x2 matrix!
1 commentaire
Christoph
le 16 Août 2017
Réponses (0)
Catégories
En savoir plus sur Surface and Mesh Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!