slice: plot complete slices

3 次查看(过去 30 天)
Christoph
Christoph 2017-8-16
评论: Christoph 2017-8-16
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 个评论
Christoph
Christoph 2017-8-16
Ok, I found a dirty fix: Simply padding the volume with NaNs or whatever you feel like putting there in an extra column and extra row (end+1) does the job.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by