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
精彩评论