help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding local minima in a multidimensional array


From: Brett Green
Subject: Finding local minima in a multidimensional array
Date: Sat, 9 Nov 2019 13:01:14 -0500

I would like to find all local minima in an array. For a 2D array M, I would want to find (i,j) such that:
M(i,j)<M(i,j+1)
M(i,j)<M(i,j-1)
M(i,j)<M(i+1,j)
M(i,j)<M(i -1,j).
I would like to do this in higher dimensions as well. This seems similar to the sort of thing that could be done with the "find" function. I've seen find used for elementwise operations, but I don't know whether it can be used for comparisons that require accessing two elements of the array which is passed in. Is that possible?

While it's easy enough to write loops to do this for 1 or 2 dimensions, it would be nice to have a more general method.

- Brett Green

reply via email to

[Prev in Thread] Current Thread [Next in Thread]