Plot 3D binary matrix as surface (or how to get 3D matrix coordinates)
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi! I got a binary 650x512x128 matrix (Let's say it's called A) that represents 128 images of a curve segmentation of size 650x512 that I want to plot as a continuous surface.
I tried using isosurface, but it seems like a scattered points that doesn't make contact between each other, so that ain't look like a surface.
I tried also to get coordinates of all points and then plot using plot3 and it works, but points are not conected, here is my code:
[x,y,z] = ndgrid(1:size(A, 1), 1:size(A, 2), 1:size(A, 3)); %get coordinates of all points
xx = x(A == 1); %keep only coordinates for A == 1
yy = y(A == 1); %these 3 lines also reshape the 3d array
zz = z(A == 1); %into column vectors
plot3(xx, yy, zz, '-');

Thanks in advance to everyone.
EDIT: I've attached the test.mat file that includes the 3D matrix.
댓글 수: 6
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!