逻辑字符使用问题?
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
腾龙游戏网址l7787482287
el 10 de Jul. de 2022
Respondida: 大子 胆
el 10 de Jul. de 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 comentarios
Respuesta aceptada
大子 胆
el 10 de Jul. de 2022
a(3*i)=='C'| a(3*i)=='G'
修改为
isequal( a(3*i), 'C' ) || isequal( a(3*i), 'G' )
试试
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!