Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Minimax problem for matrices

Subject: Minimax problem for matrices

From: Pandora lafuente

Date: 16 Apr, 2010 03:36:04

Message: 1 of 2

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

Subject: Minimax problem for matrices

From: Roger Stafford

Date: 16 Apr, 2010 04:39:04

Message: 2 of 2

"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

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us