finding the index of str's charachter from another vector
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
hello who can help me for correcting this error: str vector contains 57 character and X vector 1560 charaters. i was finding the index of str's charachter from excel data and results become 56 while i was estimating 57 because the size of str vector was 57. so i need help for this problem.
X={'as modeling of changes in backbone conformation still lacks a computationally efficient solution, we developed a discretisation of the conformational states accessible to the protein backbone similar to the successful rotamer approach in side chains. The BriX fragment database, consisting of fragments from 4 to 14 residues long, was realized through identification of recurrent backbone fragments from a non-redundant set of high-resolution protein structures. brix contains an alphabet of more than 1,000 frequently observed conformations per peptide length for 6 different variation levels. analysis of the performance of brix revealed an average structural coverage of protein structures of more than 99 percent within a root mean square distance of 1 angstrom. globally, we are able to reconstruct protein structures with an average accuracy of 0.48 angstrom rmsd. as expected, regular structures are well covered, but, interestingly, many loop regions that appear irregular at first glance are also found to form a recurrent structural motif, albeit with lower frequency of occurrence than regular secondary structures. larger loop regions could be completely reconstructed from smaller recurrent elements, between 4 and 8 residues long. finally, we observed that a significant amount of short sequences tend to display strong structural ambiguity between alpha helix and extended conformations. when the sequence length increases, this so-called sequence plasticity is no longer observed, illustrating the context dependency of polypeptide structures.'};
str='steganography is the art and science of covered or hidden';
for m = 1:numel(X)
Y = bsxfun(@eq,X{m}(:),str);
for n = 2:size(Y,2)
Y(:,n) = Y(:,n) & cumsum(Y(:,n-1))>0;
end
Z = find(any(diff([false(size(str));cumsum(Y)>0],1),2))
end
댓글 수: 5
Guillaume
2015년 5월 24일
Any time you write any kind of fairly complex expression (such as your find(any(...))) you should write a comment explaining what it's doing.
It will help any reader of your code understand what's it doing. That reader will also be you in 6 months time, because I can guarantee you won't remember what this expression is doing.
dpb
2015년 5월 24일
Hmmm...
>> length(unique(X{:}))+length(unique(str))
ans =
55
>>
So, one additional location. As Guillaume notes, need a lot more description of what you're actually trying to accomplish here to have any klew as to what, specifically, would be "the Matlab way" and what the answer should be.
Mohamuud hassan
2015년 5월 24일
편집: Mohamuud hassan
2015년 5월 24일
Jan
2015년 5월 24일
@abdulkarim hassan: If the problem is solved already, please post this as an answer and accept it. Then readers will not waste the time to understand the question anymore. Thanks.
Mohamuud hassan
2015년 5월 25일
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!