フィルターのクリア

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 Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by