逻辑字符使用问题?
이전 댓글 표시
N=zeros(1,3);
for i=1:243
if a(3*i)=='C'
N(1)=N(1)+1;
elseif a(3*i)=='G'
N(2)=N(2)+1;
elseif a(3*i)=='C'| a(3*i)=='G' %这个地方运行不出结果,改为 elseif a(3*i)=='C'| 'G'后出结果,但是应该不对
N(3)=N(3)+1;
end
end
a是729个由A、C、G、T组成的字符串,目的是计算第3、6、9、12(三的倍数)出现C、G、C或G的数目。
敬请大神指点
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!