How to get arg min of an N-dimensional Matrix ?

16 次查看(过去 30 天)
Hi, i'm having an image of size[280,307,191] and i want to get the argmin of it,Any help?

采纳的回答

James Tursa
James Tursa 2013-4-15
编辑:James Tursa 2013-4-15
[m n] = min(M(:));
[x y z] = ind2sub(size(M),n);
x, y, z will be the indexes (i.e., argmin) of the minimum value of your 3D array M.
  2 个评论
Jan
Jan 2013-4-16
The documentation of min explains this exhaustively already. Type this in Matlab's command window:
help min
doc min
and read it.

请先登录,再进行评论。

更多回答(3 个)

Cedric
Cedric 2013-4-15
How do you define argmin? If it is the global min, you can get it as follows:
min(M(:))
where M is your 3D array.
  4 个评论
Sreeda M A
Sreeda M A 2016-7-13
can you please explain what values should I give for M ??

请先登录,再进行评论。


Sean de Wolski
Sean de Wolski 2013-4-15
Or:
min(min(min(M)))
  2 个评论
Ties Hendrickx
Ties Hendrickx 2019-4-29
Nope, this will return the minimum value and not the index of the minimum value
Cedric
Cedric 2019-4-30
Just use [~,linIdx] = min(M(:)) and then convert to subscripts using IND2SUB.

请先登录,再进行评论。


Steven Lord
Steven Lord 2019-4-30
If you're using release R2019a or later, you probably want to call min with the 'all' dimension input and the 'linear' flag.

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by