How to plot certain points (or select data of specified range)

6 visualizaciones (últimos 30 días)
Mekala balaji
Mekala balaji el 7 de Ag. de 2015
Comentada: Azzi Abdelmalek el 7 de Ag. de 2015
Hi, I want to plot the below data, but only between -10~+10. The raw data is always >-10 to >10. But I only need to plot between -10 &+10. How can I select between -10 ~+10. I also want to get the index of each filtered data between -10~10. Please kindly help. Many many thanks in advance.
-14 0.28
-13 0.27
-12 0.26
-11 0.25
-10 0.24
-9 0.23
-8 0.23
-7 0.22
-6 0.22
-5 0.22
-4 0.22
-3 0.22
-2 0.22
-1 0.22
0 0.23
1 0.22
2 0.22
3 0.22
4 0.22
5 0.22
6 0.22
7 0.23
8 0.23
9 0.23
10 0.24
11 0.26
12 0.29

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 7 de Ag. de 2015
Editada: Azzi Abdelmalek el 7 de Ag. de 2015
idx=M(:,1)<10 & M(:,1)>-10
out=M(idx,:)
plot(out(:,1),out(:,2))
  2 comentarios
Mekala balaji
Mekala balaji el 7 de Ag. de 2015
Sir,
Index I want is as shown below(from 1~21, after filter, first element corresponding to -10 is 1, and +10 is 21): Please help me sir. Many thanks again.
1 -10.0000 0.2400
2 -9.0000 0.2300
3 -8.0000 0.2300
4 -7.0000 0.2200
5 -6.0000 0.2200
6 -5.0000 0.2200
7 -4.0000 0.2200
8 -3.0000 0.2200
9 -2.0000 0.2200
10 -1.0000 0.2200
11 0 0.2300
12 1.0000 0.2200
13 2.0000 0.2200
14 3.0000 0.2200
15 4.0000 0.2200
16 5.0000 0.2200
17 6.0000 0.2200
18 7.0000 0.2300
19 8.0000 0.2300
20 9.0000 0.2300
21 10.0000 0.2400
Azzi Abdelmalek
Azzi Abdelmalek el 7 de Ag. de 2015
M=[-14 0.28
-13 0.27
-12 0.26
-11 0.25
-10 0.24
-9 0.23
-8 0.23
-7 0.22
-6 0.22
-5 0.22
-4 0.22
-3 0.22
-2 0.22
-1 0.22
0 0.23
1 0.22
2 0.22
3 0.22
4 0.22
5 0.22
6 0.22
7 0.23
8 0.23
9 0.23
10 0.24
11 0.26
12 0.29]
idx=M(:,1)<=10 & M(:,1)>=-10
out=[(1:nnz(idx))' M(idx,:)]

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by