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
Mohammad Danial Bin Kamarul Zaman 2019 年 2 月 15 日
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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by