开发者

Delete data points from a vector

开发者 https://www.devze.com 2023-02-22 03:18 出处:网络
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 func

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

精彩评论

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