how to find the maximum of an array in matlab -
i have array dimensions (517,462,399). obtain matrix of size (517,462). each entry of matrix (i,j) maximum value of array divided sum of other values. is, (1,1) entry, first compare array entries (1,1,1),(1,1,2)...(1,1,399) , divide maximum value sum of remaining 398 entries.
this relatively easy achieve. apply max
, sum
functions on third dimension. division of 2 results has made element-wise .
before operator.
here code:
maxval = max(x,[],3); result = (sum(x,3)-maxval) ./ maxval;
note max
-function needs empty second argument here, because third argument indicates dimension.
Comments
Post a Comment