How to get specified values in vector?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I need some help on this.
Lets say i have a vector of: a= [1.1 1.3 1.5 1.8 2.5 3.4 6.7 6.9 8.0 10.2 15.0 17.8 21.0 23.4]
However, i only want the values of not exceeding 10 in one of my vector, which is something like that: b= [1.1 1.3 1.5 1.8 2.5 3.4 6.7 6.9 8.0]
and another vector which has values of more than 10 in it: c= [10.2 15.0 17.8 21.0 23.4]
How do i do these?
Thank you so much.
0 件のコメント
回答 (1 件)
the cyclist
2013 年 6 月 20 日
編集済み: the cyclist
2013 年 6 月 20 日
idx = a<=10;
b = a(idx);
c = a(not(idx));
2 件のコメント
Iain
2013 年 6 月 20 日
Almost the same method:
i = find(a > 10,1);
b = a(1:i);
c = a((i+1):end);
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!