필터 지우기
필터 지우기

Sorting values according to index

조회 수: 43 (최근 30일)
kash
kash 2012년 11월 29일
I have two vales
S=[70 110 65 30 25 40 60]
K=[4 2 3 1 5 7 6];
I have to sort S according to K for example 70 must be 1n 4th position 110 must be in 2nd position ,so on
X=[30 110 65 70 25 60 40],please assist

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 29일
편집: Azzi Abdelmalek 2012년 11월 29일
S=[70 110 65 30 25 40 60]
K=[4 2 3 1 5 7 6];
[~,idx]=sort(K);
out=S(idx)
  댓글 수: 6
kash
kash 2012년 11월 29일
Azzi my values in D1 ranges from -4 to 4 after performing
D1=int16(cA*32768)/8192;
where as i need from -1 to 1
Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 29일
then use
D1=int16(cA*32768)/32767

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

추가 답변 (1개)

Ilham Hardy
Ilham Hardy 2012년 11월 29일
X = S(K)

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by