From: Pekka Kumpulainen on
"kyle semno" <ravi_071(a)hotmail.com> wrote in message <i3qjoq$a3o$1(a)fred.mathworks.com>...
> Hello my friends,
>
> I am a new matlab user .
>
>
> I have a text file that looks like :
>
> 45,7,4,7,8,9,9,4,4,6,7,8,4,232,5,4,68,8,9,4
>
>
> How can I re-format the text file to look like:
>
>
> 45,7,4,7
> 8,9,9,4
> 4,6,7,8
> 4,232,5,4
> 68,8,9,4
>
> take care
> kyle

One possible way:
% read the file G.txt
D = load('G.txt');
% reshape to 4 columns
d2 = reshape(D,4,numel(D)/4)';
% write to new file
dlmwrite('out.txt',d2)
% You might want to use 'newline', 'pc', if you use PC
doc dlmwrite