"Pandora lafuente" <anlafuente@gmail.com> wrote in message <hq8lv4$hek$1@fred.mathworks.com>...
> Hi there
>
> I'm facing a problem for which I haven't yet found an answer. Hopefully gathering all the expertise of the forum I'll be able to move forward!
>
> The problem is as follows, I have two matrix that respectively represent two functions. Actually they are hipermatrix since they have three dimensions. What I want to do is calculate the matrix indexes in which the maximum is located but constrained to a condition in the other matrix. In other words, if the maximum for matrix A is in i,j,k position it should be discarded as a maximum if the element in position i,j,k of matrix B doesn't fulfill a certain condition (i.e that element has to be higher than 1).
>
> Any help will be appreciated
>
> Thanks
> Antonio
p = find(B>1);
[t,q] = max(A(p));
[i,j,k] = ind2sub(size(A),p(q));
Roger Stafford
