find subset of a set
조회 수: 25 (최근 30일)
이전 댓글 표시
I created a variable that stores a set of numbers for an arc (a,b). Sc{1,2} = [1]; Sc{2,1} = [1]; Sc{1,3} = [2]; Sc{3,1} = [2]; Sc{3,4} = [2]; Sc{4,3} = [2]; Sc{2,4} = [1]; Sc{4,2} = [1];
I would like to implement the following condition:
s{1} = [1,2];
for v = 1:n,
if s{v} is a subset of s{u}
s{v} = intersect( s{u},Sc{u,v});
end;
end;
where u is the previous node. I dont know how to code if s{v} is a subset of s{u}' in matlab. Please help.
댓글 수: 0
채택된 답변
Doug Hull
2013년 6월 7일
>> all(ismember([1 3], [2 4]))
ans =
0
>> all(ismember([1 3], [1 3 2 4]))
ans =
1
>> all(ismember([1 3], [1 2 4]))
ans =
0
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 External Language Interfaces에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!