I want to make a full string from all the "a" values that i get
    8 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    IOANNIS KORACHAIS
 am 17 Dez. 2020
  
    
    
    
    
    Beantwortet: Steven Lord
    
      
 am 17 Dez. 2020
            reversedDNA = 'TACATGA'
function complementedDNA = r_dnasepinaka(reversedDNA)
n=length(reversedDNA);
ok = num2cell(reversedDNA);
for i=1:n
    a = ok{i};
    for j = 1:length(a)
        if a(j) == 'A';
            a(j) = 'T';     
        elseif a(j) == 'T';
            a(j) = 'A';
        elseif a(j) == 'C'
            a(j) = 'G';
        elseif a(j) == 'G';
            a(j) = 'C';
        end
    end
end
0 Kommentare
Akzeptierte Antwort
  Remy Lassalle-Balier
      
 am 17 Dez. 2020
        I am not completly sure I understood your question but you could do something like this:
reversedDNA = 'TACATGA'
function complementedDNA = r_dnasepinaka(reversedDNA)
    complementedDNA = reversedDNA;
    complementedDNA(reversedDNA == 'T') = 'A';
    complementedDNA(reversedDNA == 'A') = 'T';
    complementedDNA(reversedDNA == 'C') = 'G';
    complementedDNA(reversedDNA == 'G') = 'C';
end
and something like this to get all the As:
function [UniqueCharStr , PositionList] = getSingleChar(DNA , Char)
    PositionList = find( DNA == Char );
    UniqueCharStr = DNA( PositionList );
end
getSingleChar(reversedDNA , 'A')
2 Kommentare
Weitere Antworten (1)
  Steven Lord
    
      
 am 17 Dez. 2020
        reversedDNA = 'TACATGA'
DNA = replace(reversedDNA, {'T', 'A', 'C', 'G'}, {'A', 'T', 'G', 'C'})
0 Kommentare
Siehe auch
Kategorien
				Mehr zu Operators and Elementary Operations 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!


