How to plot certain points (or select data of specified range)
4 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Azzi Abdelmalek
on 7 Aug 2015
Edited: Azzi Abdelmalek
on 7 Aug 2015
idx=M(:,1)<10 & M(:,1)>-10
out=M(idx,:)
plot(out(:,1),out(:,2))
2 Comments
Azzi Abdelmalek
on 7 Aug 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,:)]
See Also
Categories
Find more on Switches and Breakers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!