Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

HOW CAN I KEEP THE INDEX OF MAY MATRIX?????

조회 수: 1 (최근 30일)
ali hadjer
ali hadjer 2015년 11월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
heloo i have a matrix with *two vector*i want to classify my matrix within the seconde vector and *keep *the index of this matrix
1 2 3 4 5 6 7 8 9 10
3
2
3
3
3
3
1
2
4
2
my matrix will be after classification :
7 2 8 10 1 3 4 5 6 9
1 2 2 2 3 3 3 3 3 4
BUT WHEN I CALL MAY MATRIX FOR EXEMPLE /
FOR i= 1 : n
THEY USE THE INDEX OF THE FIRST MATRIX WITHOUT CLASSIFICATION AND THEY USE THE VALOR OF THE INDEX i=1

답변 (1개)

Walter Roberson
Walter Roberson 2015년 11월 23일
sortedMatrix = sortrows(YourTwoRowMatrix.').';
  댓글 수: 2
Image Analyst
Image Analyst 2015년 11월 23일
Not sure I understand.
v1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
v2 = [3, 2, 3, 3, 3, 3, 1, 2, 4, 2]
YourTwoRowMatrix = [v1;v2]
sortedMatrix = sortrows(YourTwoRowMatrix.').'
and
v1 =
1 2 3 4 5 6 7 8 9 10
v2 =
3 2 3 3 3 3 1 2 4 2
YourTwoRowMatrix =
1 2 3 4 5 6 7 8 9 10
3 2 3 3 3 3 1 2 4 2
sortedMatrix =
1 2 3 4 5 6 7 8 9 10
3 2 3 3 3 3 1 2 4 2
That doesn't look like
7 2 8 10 1 3 4 5 6 9
1 2 2 2 3 3 3 3 3 4
, not that I can do better. I have no idea whatsoever how ali classified the matrix to arrive at the after-classification matrix that was given. ali, how did you get these numbers, like the 7 in the upper left - how did you arrive at that?
Walter Roberson
Walter Roberson 2015년 11월 23일
sortedMatrix = sortrows(YourTwoRowMatrix.', 2).';

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by