Matlab的切片()函数不能正常工作所需所需、切片、不能正常、函数

2023-09-08 10:45:03 作者:◇﹏妄想者βмeι痕迹

我想在13 以Z 的位置[4:4:52]绘制离散二维图像使用以下的code线。

I want to plot discrete 2D images at 13 z locations at [4:4:52] using the following lines of code.

a=100;
[mesh.x,mesh.y,mesh.z] = meshgrid(1:1:100,1:1:100,4:4:52);
a_unifdist=0;
b_unifdist=10;
noise=a_unifdist+(b_unifdist-a_unifdist).*rand(100,100,13);
c = (a./mesh.x)+noise;
slice(c,1:100,1:100,4:4:52);

不过,我得到13连续的曲线,从1到13,而不是13离散位置如下图所示:

However, I get 13 continuous plots from 1 till 13 instead of 13 discrete locations as shown below:

有人能告诉我什么是我的错?我想要的图像叠加在在z轴[4:4:4 52] 的位置。谢谢你。

Could somebody tell me what's my mistake? I want the images to stack at [4:4:52] locations on z-axis. Thanks.

推荐答案

也许你的意思是:

slice(mesh.x, mesh.y, mesh.z, c, [], [], 4:4:52)

下面是一个更有趣的例子不是随机数据:

Here is a more interesting example than random data:

load mri
D = double(squeeze(D));

h = slice(D, [], [], 1:size(D,3));
set(h, 'EdgeColor','none', 'FaceColor','interp')
alpha(.1)