Matlab 的 slice() 函数无法按预期工作 [英] Matlab's slice() function not working as desired
本文介绍了Matlab 的 slice() 函数无法按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用以下代码行在 [4:4:52]
的 13 个 z
位置绘制离散的 2D 图像.
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);
但是,我得到了从 1 到 13 的 13 个连续图,而不是 13 个离散位置,如下所示:
However, I get 13 continuous plots from 1 till 13 instead of 13 discrete locations as shown below:
有人能告诉我我的错误是什么吗?我希望图像在 z 轴上的 [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)
这篇关于Matlab 的 slice() 函数无法按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文