Compute the complement of a set of indices in a known range
39 次查看(过去 30 天)
显示 更早的评论
I want to compute the complement of a set C. The elements are indices in the range 1 to K. Is the best/fastest/simplest way to go around this is using
C = setdiff(A,B)
or since I know they are not arbitrary sets of numbers, is there a better way to go around in MATLAB?
2 个评论
Azzi Abdelmalek
2016-4-4
What do you mean? can you clarify what "not arbitrary sets of numbers" means, with a small example
回答(1 个)
Dave Behera
2016-4-6
Your approach with setdiff seems to be the best way because it is the simplest. I recommend you to use it.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!