how to find the lowest pixel in a 3d matrix?
이전 댓글 표시
hello, I have 3D matrix with ones and zeroes. I need to know the index of the lowest and highest pixel with 1 value. lets say the Z axis is height, than I need to know the min/max height of the pixels with the value 1.
thank you!
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2013년 6월 4일
A = rand(15,5,5) < .3; % your data
s = size(A);
B = reshape(A,s(1),[]);
[ii jj] = find(B);
maxl = ii == max(ii);
[i1 j1] = ind2sub(s(2:3),jj(maxl));
maxidx = [ii(maxl),i1,j1];
minl = ii == min(ii);
[i2 j2] = ind2sub(s(2:3),jj(minl));
minidx = [ii(minl),i2,j2]
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!