逻辑字符使用问题?
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
腾龙游戏网址l7787482287
am 10 Jul. 2022
Beantwortet: 大子 胆
am 10 Jul. 2022
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 Kommentare
Akzeptierte Antwort
大子 胆
am 10 Jul. 2022
a(3*i)=='C'| a(3*i)=='G'
修改为
isequal( a(3*i), 'C' ) || isequal( a(3*i), 'G' )
试试
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!