Deemmer.m
Jump to navigation
Jump to search
function deemmer(filename) %created by Erik Stassinos 4/11/2010 %this is a short function to remove the '^M' that is created at the end of %the line by matlabs write/print function %call in the file you want deemmed hs6t =0; demfile = fopen(filename); newfile = strcat('d',filename); hs6test = filename(1,3) if strncmp(hs6test,'h',1) ~= 1 cd .. cd('final') end if strncmp(hs6test,'h',1) == 1 hs6t =1 cd('final') end newfile = fopen(newfile,'w+'); count = 0; n=2; linecount = 1; dmlength = 40; if hs6t ==1 dmlength =55; end while linecount < dmlength%feof(demfile) ~= 1 clear lineis line = fgets(demfile); lengthfirst = length(line); line = strread(line,'%s',lengthfirst)'; lengthafterread = length(line); for i = 1:lengthafterread lineis{i,:} = line{:,i}'; end % linechar = char(lineis{:,1})' %ttttttttesssssssssssttttttt for t =1:(length(lineis) -1); q = lineis{t,:}'; fprintf(newfile,'%s',q); fprintf(newfile,'%s',' '); end clear q q1 = lineis{length(lineis),:}'; fprintf(newfile,'%s\n',q1); %line = line' count = count +1; location = ftell(demfile); linecount = linecount +1; end while feof(demfile) ~= 1; nomline = fgets(demfile); fprintf(newfile,nomline); end close all pwd cd .. if strncmp(hs6test,'h',1) ~= 1 cd('processing') end