Slice does not output correct cdata
2 次查看(过去 30 天)
显示 更早的评论
Kind all,
I am having troubles in using the "slice" command in MATLAB. I have a 3D variable representing the plume of a pollutant, which I am able to visualize with contourslice:
contourslice(Xgrid,Ygrid,Zgrid,myvolume,[],[],all_the_z_levels)
where Xgrid, Ygrid, Zgrid represent the 3D meshgridding of the 3 vectors (xgrid,ygrid,zgrid) representing the 3 dimensions of my volume. All vectors are in meters.
Here's the output of my command:
As you can see my plume rises well above floor (and all zero values outside the plume have been masked to NaNs).
Now let's assume I want to take a slice of my rising plume with the following command:
h=slice(Xgrid,Ygrid,Zgrid,myvolume,xgrid(130),[],[],[]);
This means I'm slicing my volume on the x-axis at the 130th index of my xgrid vector with a single slice. Here's the output:
The expected slice would be a matrix of NaNs except where the plume is where the value of the plume are expected. You can already see from the figure that something's wrong: there is some values bleeding all down to the "ground" where no plume is residing.
In case it's not clear here's the output of the following command:
c1=get(h,'CData');
contourf(ygrid,zgrid,c1') % it's an x-plane slice, so it's plotted against y-plane and elevation
% c1 is transposed because, by some reason, even if my volume is 200(x)*200(y)*100(z), MATLAB returns a
% 100*200 slice instead of a 200*100 one
There's clearly something wrong here, since there should be no plume going to ground level. The same output is obtained with an ex-novo slice running:
xs=get(h,'xdata');
ys=get(h,'ydata');
zs=get(h,'zdata');
h2=slice(Xgrid,Ygrid,Zgrid,my_volume,xs,ys,zs) % create new slice with the x,y,z data of the original one
c2=get(h2,'CData');
contourf(ygrid,zgrid,c2');
What's wrong? Am I doing something non correctly? Are there are known bugs on the "slice" command?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Volume Visualization 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!