How can I compare among three matrices ?
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
If I have 3 matrices for example 
A = [10;26;30];  
B = [12;25;35];
C = [15;29;9];
How can I compare among them to find each matrix that have the minimum value compared to other matrices to get matrices in this form
Anew = [1;0;0]; 
Bnew=[0;1;0];
Cnew=[0;0;1];
Thanks in advance
0 件のコメント
採用された回答
  Voss
      
      
 2022 年 11 月 8 日
        A = [10;26;30];  
B = [12;25;35];
C = [15;29;9];
M = [A B C];
Mnew = M == min(M,[],2)
3 件のコメント
  Voss
      
      
 2022 年 11 月 8 日
				"I want to compare each element with element of other matrices that located at the same locations."
That's what min does in this case.
A = [10;0;0;26;0;0;30];  
B = [12;0;0;25;0;0;35];
C = [15;0;0;29;0;0;9];
M = [A B C];
Mnew = M == min(M,[],2) & M ~= 0
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Logical についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

