필터 지우기
필터 지우기

Find the min for each plane of a multidimensional array

조회 수: 2 (최근 30일)
Emanuele Mele
Emanuele Mele 2019년 2월 28일
답변: Bob Thompson 2019년 2월 28일
Hi all!
I would like to find the position and the min value for each plane of a multidimensional array (a stack).
The minimum value must be found considering the minimum of each plane and therefore not an absolute minimum because it must be in the same position for each plane.
Thank you!

답변 (1개)

Bob Thompson
Bob Thompson 2019년 2월 28일
A = randi(100,3,3,3); % Sample input
[m,r] = min(A,[],1); % Locate minimum value for all rows
[m,c] = min(m,[],2); % Locate minimum column from row minimums
for i = 1:size(A,3); % Loop through each sheet to combine index
idx(:,:,i) = [r(:,c(:,:,i),i),c(:,:,i)]; Combine for ordered pair
end
So, minimum has the ability to determine minimums along a specified dimension. Unfortunately, unlike max(), it can only be done along one dimension at a time.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by