How to extract matrix values of a different column that correspond to a value in another column?
1 view (last 30 days)
Show older comments
In the matrix uxcLYS generated, I want to extract only the x,y,z column values that corresponds to 'CB','CG','CD','CE' in the atom name column. How to do it?
uxc = getpdb('1UXC');
No_of_residues = uxc.Sequence.NumOfResidues
isLYS = ({uxc.Model.Atom.resName} == "LYS");
uxcLYS = uxc.Model.Atom(isLYS)
0 Comments
Accepted Answer
Venkat Siddarth
on 6 Mar 2023
I understand that you are trying to extract specifc columns corresponding to few atom names in the above structure.This can be achieved as follows
%Given Code
uxc = getpdb('1UXC');
No_of_residues = uxc.Sequence.NumOfResidues
isLYS = ({uxc.Model.Atom.resName} == "LYS");
uxcLYS = uxc.Model.Atom(isLYS)
Since uxc is a structure element,for easy access we can convert this to table as follows:
%Structure to Table
req=struct2table(uxc.Model.Atom)
After this we will apply the required constraints;
%converting the column AtomName to string array;
atomName=string(req.AtomName);
%Applying the constraints
ans=req(ismember(atomName,[ "CB","CG","CD","CE"]),["AtomName" "X" "Y" "Z"])
I hope this resolves your query.
Thanks,
Venkat Siddarth V
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!