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.

 採用された回答

Thorsten
Thorsten 2015 年 11 月 9 日

0 投票

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

2 件のコメント

Ujwal
Ujwal 2015 年 11 月 9 日
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.
Thorsten
Thorsten 2015 年 11 月 9 日
The second output argument of min and max give the index:
[mtl idx_mtl] = min(totalLoad([1:idx-1 idx+1:end]));

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2015 年 11 月 9 日

コメント済み:

2015 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by