开发者

Delete data points from a vector

I am sup开发者_JAVA百科posed to delete some points from a plane following a rule, or, I could say, under a constraint, defined by a generic inequality. How can I do that, or maybe Matlab offers a function for that?


Difficult to know what you are after but if you're just trying to delete data from a vector (or matrix) based on some condition, you can do the following

a = [ 1 3 6 4 22 41];  
delIndex = find( rem(a,2) ~= 0 ); 
a(delIndex)=[]


a =

     6     4    22

or the logic could be in a function (anonymous or otherwise)

somefunc = @(v) (v == cumsum(v));

a = [ 1 3 6 4 22 41]; 

a(somefunc(a)) = []

a =

     3     6     4    22    41
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜