MATLAB Answers

Ordering a column with respect to another column.

조회 수: 15(최근 30일)
Trambak 2014년 4월 1일
댓글: Trambak 2014년 4월 1일
Hi, I have a matrix with 2 columns and N (=50) rows. The columns have positive real numbers. I intend to order the elements of column 1 keeping column 2 fixed so that column 1 and column 2 become oppositely arranged. In other words, keeping column 2 fixed, re-order column 1 so that
corr(column 1, column 2, 'type', 'Kendall') = -1
Any ideas on how I can proceed with this?
Many Thanks!

채택된 답변

lvn 2014년 4월 1일
편집: lvn 2014년 4월 1일
This should do it:
corr(A(:,1), A(:,2) , 'type', 'Kendall')
  댓글 수: 2
Trambak 2014년 4월 1일
Thanks a lot. This works perfectly. I am actually going to try and use this iteratively on an N x 3 matrix and arrange the jth column so that it is oppositely arranged to the sum of the other 2, 1<= j <= 3.

댓글을 달려면 로그인하십시오.

추가 답변(0개)



Community Treasure Hunt

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

Start Hunting!

Translated by