逻辑字符使用问题?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
大子 胆
il 10 Lug 2022
a(3*i)=='C'| a(3*i)=='G'
修改为
isequal( a(3*i), 'C' ) || isequal( a(3*i), 'G' )
试试
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!