home = 'E:\Malito\212_Flaxman_ReRun\Turn Off Erosion'
cd(home)

%% format tce like dep file
len = 1:292;
mat(len,1) = 0;
mat(len,2) = 0;
mat(len,3) = 1000;
mat(len,4) = 0;
mat(len,5) = -999;

% write tcd file
name = 'mudtcd';

clear i
fid = fopen(name,'w+');

for i=1:numel(mat(1,:)),
    fprintf(fid,'%f ',mat(:,i));
    fprintf(fid,'\r\n');
end

fclose(fid)

movefile(name,[name '.tcd'],'f')
