How to find rearrange these values in a new row and column?

조회 수: 1 (최근 30일)
For example: I have the following array of data.
column 1 column 2
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
I would like to make a new array of data sets with
column 1 column 2
2 3
4 5
5 6
8 9
What would be the best command to rearrange the matrix?

채택된 답변

Star Strider
Star Strider 2019년 2월 15일
One approach:
A = [1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9];
L = ismember(A(:,1), [2 4 5 8]);
B = A(L,:)
produces:
B =
2 3
4 5
5 6
8 9

추가 답변 (1개)

madhan ravi
madhan ravi 2019년 2월 15일
newmatrix = matrix([2 4 5 8],:)
  댓글 수: 4
madhan ravi
madhan ravi 2019년 2월 15일
Could you attach your file? and please explain what you want to do.
Mohammad Danial Bin Kamarul Zaman
I managed to solve the problem. Thank you soo much for your consideration. If you don't mind, I have another question that I would like to ask. Feel free to have a look at the link below:
Please accept my apologies for asking a lot of questions, i'm still new to MATLAB and eager to learn more about it.

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by