I have a list of strings that I am looking for in a pdb
X1 = ['N' 'CA' 'CB' 'CG1']%Isoleucine
I want to compare these strings to the atoms as so:
atoms = find(strcmp({pdb.Model.Atom(:).resName}, 'ILE') & ...
(strcmp({pdb.Model.Atom(:).AtomName}, 'N') |...
strcmp({pdb.Model.Atom(:).AtomName}, 'CA') | ...
strcmp({pdb.Model.Atom(:).AtomName}, 'CB') | ...
strcmp({pdb.Model.Atom(:).AtomName}, 'CG1')))
Is there a more concise way to do this? Also is there a way for strcmp to do an exact match? not just if it contains the string?
EDIT:
A more concrete example:
I want to be able to do this:
strcmp(['hello' 'world'], ['hello' 'world' 'this' 'is' 'a' 'test'])
and it returns whether it matched with hello or world. This instead returns a zero saying that it can't find this array ['hello' 'world'] in ['hello' 'world' 'this' 'is' 'a' 'test'].
Essentially I just want to know if 'hello' and 'world' are in the larger array instead of checking if it contains both 'hello' and 'world' in the same row
['hello' 'world']is not a list of strings in MATLAB: it's a single string'helloworld'.