I have the following code:
[~,ind]=max(Defender.Q,[],6);
Defender.Q is a HUGE multidimensional matrix.
When there are multiple maximums in the 6th dimension of Defender.Q, the max function
is giving me the index of the first of these multiple maximums. I want to get an index
that is randomized between multiple maximums. Any ideas? Thanks for your help!
Ok, this is a bit involved, but you can get the indices of all the maxima, and then randomly pick one using
randiandaccumarray: