Ondrej
Posts:
19
Registered:
2/3/09
|
|
find and replace string in a text file
Posted:
Mar 7, 2009 6:38 AM
|
|
Hi Guys, can you please give me some advise how can I search and replace a word (string) in a text file using Matlab only (no perl),... I was trying the following but it doesn't work,... thanks a lot, Ondrej
fid = fopen('118521_1.TXT');
while(~feof(fid)) s = fgetl(fid); s(find(s=='118520'))='118521'; %% <<< ==== fprintf(fid,'%d',s); disp(s) end fclose(fid);
|
|