help with matlab char arrays
help with matlab char arrays
(OP)
Hi
I'm new to matlab, and i'm having some trouble and hope that you can help.
I need to create a 100 row * 500 col array in which each element holds one of 4 letters (a,t,g,c - dna). I'n not sure how to do this, yet.
Will i need to create a for loop? and how can i fill an array in matlab with letters?
I'd really apprciate any help
Thanks for your time
SnkMajin
I'm new to matlab, and i'm having some trouble and hope that you can help.
I need to create a 100 row * 500 col array in which each element holds one of 4 letters (a,t,g,c - dna). I'n not sure how to do this, yet.
Will i need to create a for loop? and how can i fill an array in matlab with letters?
I'd really apprciate any help
Thanks for your time
SnkMajin





RE: help with matlab char arrays
Here is one solution to your problem
CODE
r = ceil(4*rand(100,500)); % generates random numbers 1-4 in a 100x500 matrix
m = dna(r); % matrix of random dna.
RE: help with matlab char arrays
Wow thanks, that works a treat! :D
I've been wracking my brain and had no joy! Had a different approach but your is way better.
I'm gonna have to manipulate this array now and think i have an idea.
Hope you dont mind me pestering you if icant get it to work.
Thanks again!
SnkMajin