comparing two matrices satisfying two conditions.

Hi, I am new in matlab and unable to solve a problem.
Problem goes like this:
I have two matrices named: total_load and maxLoad: both of them 16*1 matrix.
I want to know BestRoute. The condition is to find (min(total_load) && ~max(maxLoad));
Which mean I want to find minumum in total_load matrix but excluding row which contains maximum in maxLoad matrix. I want to display BestRoute in terms of position of total_load matrix.

 Accepted Answer

[~, idx] = max(maxLoad);
mtl = min(totalLoad([1:idx-1 idx+1:end]));

2 Comments

Thank you for the solution. I am pleased but one more question please if you can reply. I also want to display the position of 'mtl' which exists in matrix total_load. Thank you.
The second output argument of min and max give the index:
[mtl idx_mtl] = min(totalLoad([1:idx-1 idx+1:end]));

Sign in to comment.

More Answers (0)

Asked:

on 9 Nov 2015

Commented:

on 9 Nov 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!