How to plot certain points (or select data of specified range)
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Azzi Abdelmalek
2015-8-7
编辑:Azzi Abdelmalek
2015-8-7
idx=M(:,1)<10 & M(:,1)>-10
out=M(idx,:)
plot(out(:,1),out(:,2))
2 个评论
Azzi Abdelmalek
2015-8-7
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,:)]
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Switches and Breakers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!