Hi there! I have a problem with editing series of numbers that are located in a specific address in a text file. First I extracted series of numbers from that text file, then I have modified them and finally put them in a new matrix B. here is code which I have written.
inp= fopen('DEY.inp','r+');A= textscan(inp,'%s %d %d %d','headerlines', 144); %read text file and put it in A, ignor first 144 lines
B = zeros(1,41);X=1.5;for k=1:41B(1,k) = X*A{1,2}(k,1);% multiply numbers located in a specific address of A and put them in B matrix
end
now I have to return modified numbers that I have put in matrix B, to the same address of the same text file (DEY.inp). I mean that numbers located in a specific address of DEY.inp must be precisely replaced with numbers multiplie by X. How is it possible? with fprintf maybe? I have attached my text file with .txt format..
Best Answer