フィルターのクリア

Finding maximum between every two rows of a matrix

1 回表示 (過去 30 日間)
Christopher
Christopher 2013 年 11 月 17 日
編集済み: Walter Roberson 2013 年 11 月 17 日
Hello everyone,
I have a matrix that I am trying to break up based on maximums. I will explain this with a simplified example. So I have a matrix as follows:
A=[1 2 3;6 7 8;4 5 6;1 2 3;4 5 6;1 2 3];
I am trying to create a new matrix based off of this matrix as follows. I want to include the first and last row UN-changed in the new matrix, then find the maximum between every two rows of column 2 and return that row to the new matrix. So the new matrix would be
newA=[1 2 3;6 7 8;4 5 6;1 2 3]
So the first row in newA is [1 2 3] because it is left unchanged. Row 2 is [6 7 8] because between row 2 and 3, row 2 has the larger value in column 2. Row 3 is [4 5 6] because between row 4 and 5, row 5 has the larger value in column 2. Row 4 is [1 2 3] because it is left unchanged.
Any help would be great. Thanks!
  1 件のコメント
Walter Roberson
Walter Roberson 2013 年 11 月 17 日
編集済み: Walter Roberson 2013 年 11 月 17 日
This looks like it should be similar to your earlier question http://www.mathworks.co.uk/matlabcentral/answers/106342-finding-maximums-in-matrix-columns . I don't see the difference at the moment ?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by