How to create an alphabetical matrix?

1 回表示 (過去 30 日間)
Joey Smith
Joey Smith 2017 年 10 月 5 日
コメント済み: Joey Smith 2017 年 10 月 5 日
Given:
D = [12 3 56 78 3 4 5 10 91 21]
E = [16 81 18 3 5 7 9 12 9 11]
F = [6 7 68 24 13 2 8 16 22 2]
I need to write a Matlab code that creates a new alphabetical matrix that displays the letter of the matrix that has the HIGHEST value of the 3 matrices D, E, F from above on an element by element basis.
I know that the new matrix should be:
OutputMatrix = [E E F D F E E F D D]
However, I am unsure how to arrive at that output using Matlab. Is this possible? Any help appreciated. Thanks in advance.

採用された回答

Walter Roberson
Walter Roberson 2017 年 10 月 5 日
  7 件のコメント
Walter Roberson
Walter Roberson 2017 年 10 月 5 日
mask is not a feature, it is just a variable name.
m = max( max(A, B), C );
mask1 = m == A
mask2 = m == B
mask3 = m == C
Joey Smith
Joey Smith 2017 年 10 月 5 日
I think I got it now. You are a very patient man. Thank you! :-)

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 10 月 5 日
Hint:
[a, b] = max([D;E;F]', [], 2)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by