Elements in a set that are not elements of another set (relative complement) [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 06:36:14

问题


In matlab, how can I implement the following?

Say that I have some set A and another set B, both of which have some elements. How can I write a function that returns only the values of B that are not in A (relative complement of A in B B\A?

Thanks.


回答1:


use setdiff

dif = setdiff( A, B )


来源:https://stackoverflow.com/questions/14770613/elements-in-a-set-that-are-not-elements-of-another-set-relative-complement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!