from
CatOrSplitFile
by Michael Robbins
concatenates or splits files with an optional token header.
|
| RemoveCatOrSplitFilesHeaders(infilename,outfilename)
|
function slurp = RemoveCatOrSplitFilesHeaders(infilename,outfilename)
slurp = [];
if nargin<2 outfilename = infilename; end;
if exist(outfilename)==2
system(sprintf('copy %s %s.rcosfh.bak', ...
which(outfilename),which(outfilename)));
end;
FID = fopen(which(infilename),'rt');
if FID == -1
errordlg(sprintf('cannot open %s',which(infilename)),mfilename);
else
slurp = fscanf(FID,'%c');
fclose(FID);
slurp = regexprep(slurp,'CatOrSplitFiles[^\n]+','');
FID = fopen(which(outfilename),'wt');
if FID == -1
errordlg(sprintf('cannot open %s',which(outfilename)),mfilename);
else
fprintf(FID,'%s',slurp);
fclose(FID);
end;
end;
|
|
Contact us at files@mathworks.com