k-Wave Toolbox

maxND

Return the value and indices of the largest value in an N-D array.

Syntax

max_val = maxND(mat)
[max_val, ind] = maxND(mat)

Description

maxND returns the largest value in the N-D array given by mat. The indices of the largest value within the array can also be returned, where ind = [ind_dim_1, ind_dim_2, ... , ind_dim_N]. The indices can be used to directly address the largest value, i.e., max_val = mat(ind).

Inputs

mat input array

Outputs

max_val largest value in mat
ind array of indices corresponding to the location of the largest value in mat