MATLAB Answers


Max value of each vector in a 3D hyperspectral data matrix

Asked by SImon Appeltans on 18 Jun 2019
Latest activity Commented on by SImon Appeltans on 19 Jun 2019
I have 3D datacubes (hyperspectral images), and would like to come up with the position of the maximum value in each of the vectors along the z dimension.
So for every pixel with (x,y) coordinates, I want to know what the position is of the maximum value in the (x,y,:) vector, the max. of all z values).
is there a way to do this without running a for-loop with find?


Sign in to comment.

1 Answer

Answer by Honglei Chen
on 18 Jun 2019
 Accepted Answer

Let's say xc is your datacube, does
[z_max,z_ind] = max(xc,[],3)
satisfy your needs?

  1 Comment

Sign in to comment.