Eliminate rows of cell array outside of a range

>> final2{1}
ans =
-7.001608047186611 5.177463903868721
-6.961013319638841 4.836001516995353
-7.434718451674193 5.161775286393533
-7.291806764176719 4.945616389566389
-7.825126063233940 5.291205007203436
-6.988927204305714 5.113082581858984
-6.849059418431168 4.861214486264909
-5.940365630308799 4.722209572707015
-7.176195913281045 5.017166824644659
What is the command to eliminate all rows if the value of the first column is outside a certain range (say, greater than -6.0 or less than -7.0)? In this case the output would be:
>> final2{1}
ans =
-6.961013319638841 4.836001516995353
-6.988927204305714 5.113082581858984
-6.849059418431168 4.861214486264909
Thanks!

답변 (3개)

Youssef  Khmou
Youssef Khmou 2013년 5월 8일

0 개 추천

hi try :
final2{1}(final2{1}>-0.6&final2{1}<-0.7)=[];
Azzi Abdelmalek
Azzi Abdelmalek 2013년 5월 8일

0 개 추천

a= final2{1}
a(a(:,1)>-6 | a(:,1)<-7,:)=[]
final2{1}=a
Andrei Bobrov
Andrei Bobrov 2013년 5월 8일

0 개 추천

final2{1} = final2{1}(final2{1}(:,1)>-7 & final2{1}(:,1)<-6 ,:)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

태그

질문:

2013년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by