採用された回答

Oleg Komarov
Oleg Komarov 2011 年 4 月 22 日

0 投票

qw = 1:0.4:50;
c = [9;17;25;1;43];
tol = .5;
(a) Bsxfun solution
Out = qw(~any(bsxfun(@ge, qw, c-tol) & bsxfun(@le, qw, c+tol)));
(B) Arrayfun solution
Out = qw(~arrayfun(@(x) any(x >= c-tol & x <= c+tol),qw))

3 件のコメント

Sindhu Kaimal
Sindhu Kaimal 2011 年 4 月 22 日
I wish to exclude all the points that are (c to c+0.5) and from (c-0.5 to c). For example all points from 8.5- 9.5 and so on...
Oleg Komarov
Oleg Komarov 2011 年 4 月 22 日
So, did you try the code? Now, (b) solution also is consistent with (a)
Sindhu Kaimal
Sindhu Kaimal 2011 年 4 月 22 日
Yes, thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Resizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by