hi a have bellow code for change an string in my text file
fid = fopen('test.txt','r')line = 0;all ={};while line ~= -1 line = fgets(fid); if line ~= -1 all = [all;line]; endend fclose(fid) ;buffer = fileread('test.txt') ;i=4 data = (all{i}) c=300 d= 200 b = 'c , d' buffer = regexprep(buffer, data,b) ; fid = fopen('test.txt', 'w') ; fwrite(fid, buffer) ; fclose(fid) ;
i want to write c and d both with a ',' between them data (specific line) , but it (regexprep) not accept both of them with that format or i cant use it truly if anyone know how to fix that help! thanks
Best Answer