문제

I am new in Matlab I hope this question worth it. I have 2 sets of numbers. a=[0;0.01;0.02;0.03;...] (4187*1) b=[0;0.3;0.4;0.1;0.23;...] (4187*1) By defining f=[a b] (4187*2) Matrix I want to filter my rows by condition on b value (b>0.05) and I want to see the results in (a b) format. Can you help me on writing this program?

도움이 되었습니까?

해결책

If you want to filter your rows depending on values in b then you can do this:

f = [a,b];
f = f((f(:,2)<=0.05),:);

This will keep all of the values less than or equal to 0.05 based on the values from b. This is assuming you want to delete all the rows of b>0.05

If you want to keep the values of b>0.05 then you would use this:

f = [a,b];
f = f((f(:,2)>0.05),:);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top