MATLAB Answers

0

Generate row or column permutation

Asked by huda ali on 4 May 2019
Latest activity Commented on by huda ali on 4 May 2019
Hi, I have row and column vectors x,y respectivily
assume N=3 , x={0.587 0.344 .712} , y={ 0.987 0.952 0.689 } after that the ascending order of x&y as shown Bx=sort(x); By=sort(y); the result for that
Bx={0.344 0.587 0.712}, By={0.689 0.952 0.987}
My question here >>>How taking the index of Bx&By from x&y to generate row and column permutation vectors to obtain the result as mm={2 1 3},and nn={3 2 1 }

  0 Comments

Sign in to comment.

2 Answers

Answer by KALYAN ACHARJYA on 4 May 2019
 Accepted Answer

[c1,mn]=ismember(x,Bx);
[c2,nn]=ismember(y,By);

  3 Comments

Thank you but I want to know how to get the values mm ,i mean followed the values of Bx ,x and then obtain the values of mm . know how gets that ??
disp(mn);
thanks soo much , the values of mm are available in reference i need how get these values

Sign in to comment.


Answer by Image Analyst
on 4 May 2019

Try
[Bx, mm] = sort(x, 'ascend');
[By, nn] = sort(y, 'ascend');

  3 Comments

Thank you and finally the solution has been
You're welcome. Could you accept the best answer, and at least vote for mine?
Thank you again and I vote for you

Sign in to comment.