Code covered by the BSD License  

Highlights from
Write a cell array to a text file

from Write a cell array to a text file by Ameya Deoras
Write formatted data from a cell array to a text file

fwritecell_example.m
C={ 1, 2, 'hello',                 3.45
   34, 2, 'this is a long string', 4
    2, 4, 'g',                    24.13312};

%Recommended approach specifying field widths
%example %8.5f implies at least 8 characters long
%with 5 after the decimal point
fwritecell('textfile1.txt','%2d %1d %21s %8.5f',C);

%Write fixed width. Note that the decimal points are not
%lined up
fwritecell('textfile2.txt',C);

%This call is similar to the first one, but note that the
%columns do not have a fixed width.
fwritecell('textfile3.txt','%d,  %d, %s, %f',C);

Contact us at files@mathworks.com