Borrar filtros
Borrar filtros

Find the min for each plane of a multidimensional array

2 visualizaciones (últimos 30 días)
Emanuele Mele
Emanuele Mele el 28 de Feb. de 2019
Respondida: Bob Thompson el 28 de Feb. de 2019
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!

Respuestas (1)

Bob Thompson
Bob Thompson el 28 de Feb. de 2019
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.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by