How to return corresponding element in two same same size matrices
이전 댓글 표시
I have two 360*360 matrices (x,y). I want to find the minimum value in each column of the y matrix (YMin - 1*360) and then find the values of the corresponding elements in the x matrix (XMin - 1*360). I tried to use the row numbers but I'm missing something simple here;
[YMin, YRow] = min(y);
XMin = x(YRow);
채택된 답변
추가 답변 (1개)
madhan ravi
2018년 11월 8일
편집: madhan ravi
2018년 11월 8일
a=rand(4) %fake datas as an example
b=rand(4)
[values,indices]=min(a)
b(indices)=a(indices) %corresponding elements are replaced in second matrix b
댓글 수: 2
madhan ravi
2018년 11월 8일
편집: madhan ravi
2018년 11월 8일
Then find the values of the corresponding elements
Need some explanation here
you want to returns the corresponding linear index or row?
Give a short example of your output using 2 by 2 matrix
see edited answer
Jordan Ballantyne
2018년 11월 8일
편집: Jordan Ballantyne
2018년 11월 8일
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!