Effacer les filtres
Effacer les filtres

how to convert a long list into an array with semicolongs

2 vues (au cours des 30 derniers jours)
David
David le 13 Sep 2013
I'm pretty new to MatLab but while this seems very simple I can't find an answer
I am downloading amino acid or nucelotide sequences from the NIH data base, and these appear like
CGTGAATACAAAAATATGCCAGCTTGCTAATATAATAACGATGTTTTCAAATCCATTAAGTTAACAACAA
that go on for hundreds or thousands of letters
I'm using each letter to trigger a different event, in this case play a different sound
to do so I need each letter separated by a semicolon, which I believe makes it a separate row in an array
is there an instruction that will take a string of letters as above and insert a semicolon between the letters?
thanks very much, Dave

Réponses (2)

Simon
Simon le 13 Sep 2013
Modifié(e) : Simon le 13 Sep 2013
Hi!
What exactly do you need? Do you have a loop for playing sounds according to the letters?
for n = 1:length(str)
switch (str(n))
case 'C'
% play a C
case 'G'
% play a G
case 'T'
% play a T
case 'A'
% play a A
end
end

David
David le 13 Sep 2013
Simon, thanks very much for your help
so, first I tried this
for n = 1:length(ORFMAPT)
switch (ORFMAPT(n))
case 'C'
sound(C)
case 'G'
sound(G)
case 'T'
sound(T)
case 'A'
sound(A)
end
end
where ORFMAPT is a long list of nucleotides 'atcgcgtat...' and the sounds are ones I entered and named C,G,T,A= if I just write sound(A) and return I get the sound, but if I use the above, nothing plays. If you have any advice, very appreciated.
Essentially if something like this works the original question is moot, as I won't need to place each amino acid or nucleotide in an array
thanks again, Dave
  1 commentaire
Simon
Simon le 16 Sep 2013
Hi!
Is your string composed of upper or lower case letters? Try using the "upper" function in
switch upper(ORFMAPT(n))

Connectez-vous pour commenter.

Catégories

En savoir plus sur Protein and Amino Acid Sequence Analysis dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by