필터 지우기
필터 지우기

Slice does not output correct cdata

조회 수: 2 (최근 30일)
Federico
Federico 2016년 1월 14일
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개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by