How to extract matrix values of a different column that correspond to a value in another column?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Masha
am 6 Mär. 2023
Kommentiert: Masha
am 9 Mär. 2023
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 Kommentare
Akzeptierte Antwort
Venkat Siddarth
am 6 Mär. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!