Yeyy! I solved it...following is the code...if somebody need it...
function main
A = regexp(fileread('datap.dat'),'\n','split');
Whichline = find(~cellfun('isempty',...
strfind(A,'TS 0 ')))
gage5 = [];
gage10 = [];
gage13 = [];
gage19 = [];
TS_sec = [];
idx=[Whichline];
n = length(idx);
for i = 1:n
TimeStp = regexp(A{idx(i)},' ','split');
TS_sec = [TS_sec; TimeStp{4}];
gage5 = [gage5; A{idx(i)+5}];
gage10 = [gage10; A{idx(i)+10}];
gage13 = [gage13; A{idx(i)+13}];
gage19 = [gage19; A{idx(i)+19}];
end
gage5_m= str2num(gage5);
gage10_m= str2num(gage10);
gage13_m= str2num(gage13);
gage19_m= str2num(gage19);
T_sec= str2num(TS_sec);
%1st Option
gtable = table(T_sec, gage5_m, gage10_m, gage13_m, gage19_m);
writetable(gtable,'gtable.dat','WriteVariableNames',true);
write_files('Sroy.dat', T_sec, gage5_m, gage10_m, gage13_m, gage19_m);
end
function write_files(fname, T_sec, gage5_m, gage10_m, gage13_m, gage19_m)
fid = fopen(fname, 'w');
fprintf('%f %f %f %f %f\n',[T_sec gage5_m gage10_m gage13_m gage19_m]');
fprintf(fid,'%f %f %f %f %f\n',[T_sec gage5_m gage10_m gage13_m gage19_m]');
fclose(fid);
end