How to extract matrix values of a different column that correspond to a value in another column?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Venkat Siddarth
le 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!