Conditional Indexing Using Specific Numbers in A Column

3 Ansichten (letzte 30 Tage)
SRB
SRB am 17 Mai 2020
Beantwortet: Jyotsna Talluri am 26 Mai 2020
I have the following 2156 x 11 matrix (A). I have attached the matrix. I want to use column 11 to get all rows between 5001's and 6001's and put them in another matrix (B). I also want to get all the rows between 5001's and 1001's and put them in another matrix (C).
Below is a truncated version of column 11:
1001
0
0
0
0
0
0
5001
1001
0
0
0
0
0
5001
1001
0
0
0
0
5001
0
1001
0
0
0
0
5001
1001
0
0
0
0
5001
6001
.
.
.
  2 Kommentare
Jyotsna Talluri
Jyotsna Talluri am 25 Mai 2020
Is first 5001 and last 6001 of 11th column to be considered ?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jyotsna Talluri
Jyotsna Talluri am 26 Mai 2020
load('MyData.mat');
a=find(MyData(:,11)==5001);
b=find(MyData(:,11)==6001);
matrixA=MyData(a(1):b(end),:);

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by