Borrar filtros
Borrar filtros

separate specific values from matrix

1 visualización (últimos 30 días)
shanmukh
shanmukh el 18 de Feb. de 2013
how to separate column 1 values 4541,4546,4546... and their corresponding column 2 values 0,1,2... in a separate matrix
sample matrix
4541 0
4556 0.025
4558 0.05
4561 0.075
4559 0.1
4559 0.125
4561 0.15
4560 0.175
4561 0.2
4561 0.225
16 0.25
12 0.275
10 0.3
10 0.325
11 0.35
10 0.375
12 0.4
10 0.425
10 0.45
11 0.475
10 0.5
10 0.525
11 0.55
10 0.575
12 0.6
10 0.625
10 0.65
12 0.675
10 0.7
10 0.725
10 0.75
10 0.775
11 0.8
11 0.825
10 0.85
11 0.875
10 0.9
11 0.925
11 0.95
10 0.975
4546 1
4557 1.025
4559 1.05
4561 1.075
4559 1.1
4561 1.125
4561 1.15
4561 1.175
4562 1.2
4561 1.225
17 1.25
12 1.275
10 1.3
11 1.325
11 1.35
10 1.375
12 1.4
10 1.425
10 1.45
12 1.475
10 1.5
11 1.525
10 1.55
10 1.575
11 1.6
10 1.625
10 1.65
11 1.675
10 1.7
11 1.725
10 1.75
10 1.775
12 1.8
10 1.825
11 1.85
10 1.875
10 1.9
12 1.925
10 1.95
10 1.975
4546 2
4557 2.025
4560 2.05
4560 2.075
4559 2.1
4561 2.125
4561 2.15
4561 2.175
4561 2.2
4559 2.225
end

Respuesta aceptada

Thorsten
Thorsten el 18 de Feb. de 2013
Editada: Thorsten el 18 de Feb. de 2013
ind = find(X(:, 1) > 4000);
Y = X(ind, :);
  4 comentarios
shanmukh
shanmukh el 18 de Feb. de 2013
how to find the first least number, greater than 4000 in every 40 rows in column 1 and corresponding value in column 2
Thorsten
Thorsten el 18 de Feb. de 2013
Sorry, I haven't realized that you are only interested in the first row of a greater 4000 block. Here is how you can do it
ind = find(diff(X(:, 1)) > 4000) + 1;
if X(1,1) > 4000, ind = [1; ind]; end
Y = X(ind, :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by