How to extract matrix values of a different column that correspond to a value in another column?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Venkat Siddarth
2023 年 3 月 6 日
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
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!