10/31/2012

Replacing ^M with new-line

I have a file with the following texts, in which ^M is made of Ctrl-M.
Obviously I need to replace the Ctrl-M's with "new-line" specical characters.
To complete this task, a ed command of "1:$s/Ctrl-QCtrl-M/\r/g" will

% impact on IS n and VTo from doping conc deviations ^M% The parameters are extracted from Charge Sheet Model^M% trisigmas are displayed in the command window^Mclear^Mclf^M^M% data acquisition (com. gate) ----------^Mm = 500; % number of samples.^M% data -------------------------------- ^MT = 300; % ?K^MN = 1.0e17*(1 + .01*randn(1,m)); % cm^-3^Mtox = 5.; % nm^MVFB = .8; % V^M^M% compute --------------------------------------^M% 1 ----- acquisition of n, VTo and IS from Charge Sheet Model ^Mp = pMat(T,N,tox);^Mz = 50; Isu = logspace(-7,-5,z);^MUG = .6: .1: 1.2;^MUS = [.1 .6];^M^Mfor zz = 1:length(UG),^M VG = UG(zz);^M US1 = US(1);^M IDu1 = IDsh(p,US1,5,VG+VFB)'; ^M i1 = IDu1(:,ones(1,z))./Isu(ones(m,1),:);^M q1 = .5*(sqrt(1 + 4*i1) - 1);^M VP1 = US1 + p(3,1)*(2*(q1-1) + log(q1));^M^M US2 = US(2);^M IDu2 = IDsh(p,US2,5,VG+VFB)'; ^M i2 = IDu2(:,ones(1,z))./Isu(ones(m,1),:);^M q2 = .5*(sqrt(1 + 4*i2) - 1);^M VP2 = US2 + p(3,1)*(2*(q2-1) + log(q2));^M^M R = VP1./VP2;^M for k = 1:m,^M ISux(k,zz) = interp1(R(k,:),Isu',1,'spline');^M VP(k,zz) = interp1(Isu,VP2(k,:),ISux(k,zz),'spline');^M end^Mend^M^M% 2 ----- statistical analysis^Mfor h = 1:m;^M P1 = polyfit(VP(h,:),UG,1); ^M n(h,1) = P1(1); ^M VTo(h,1) = P1(2);^M ISu = mean(ISux')';^Mend^M^M% plot ----------------------------------------------^M^Msubplot(2,2,1); Gss(n); title('P(n)'); xlabel('n');^Mmean(n)^Msubplot(2,2,2); Gss(ISu); title('P(I_S_u)'); xlabel('I_S_u (A)');^Mmean(ISu)^Msubplot(2,2,3); Gss(VTo); title('P(V_T_o)'); xlabel('V_T_o (V)');^Mmean(VTo)^Msubplot(111)

沒有留言:

張貼留言