Printing results to a file or two screen.
1 view (last 30 days)
Show older comments
I have created a small program to find all combinations of cetain length possible with the four DNA bases (A,T,G,C) and then search inside a sequence to count the occurences of each combination.
I end up with two arrays, one containing the possible combinations and the other integer values of occurences.
For example for all possible triplets we get an array M<64x3 char> and the array C<1x64 double>.
My problem is, I don't know how to print the results in a file with two columns, one containing each combination as a string (for example "AT" or "CG") and the other column containing the appropriate C value (counts, for example "5").
Actually I would like to be able to use this array to print histograms etc.
I would appreciate any help. Thanks in advance.
0 Comments
Answers (1)
Pavel Gorodetsky
on 15 Jun 2012
i would use the fprintf function. first you have to open a file for writting and then simply loop your data and write each row to the file. the code would look something like this:
fid = fopen('output.txt', 'w');
for ii = size(M,1)
fprintf(fid, '%s %d\r\n', M(ii, :), C(ii) );
end
fclose(fid)
0 Comments
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!