0

Given the following cell array of strings:

a(1) = {{'one', 'two', 'three', 'four'}}
a(2) = {{'one', 'two', 'four', 'five'}}
a(3) = {{'four', 'five', 'six', 'seven'}}

b = {'one', 'two'}

is there a way to check whether both strings in b are contained in each subcell of a?

In my example a(1) and a(2) would fill this requirement.

Daniel Heilper
  • 1,182
  • 2
  • 17
  • 34
HappyPy
  • 9,839
  • 13
  • 46
  • 68

1 Answers1

4
>> cellfun(@(x) all(ismember(b, x)), a)

ans =

     1     1     0
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147