How to modify few numbers in a random text file?
이전 댓글 표시
I am uploading a text file related to a model in an electronic simulator. How to modify the 4 parameters named with
toxe = %1.1d
toxp = %1.1d
toxm = %1.1d
vth0 = %1.1d
If this text file didn't have format specifier, I would just write this file using
model = fileread(fullfile(pathname_model,filename_model));
File_model = fopen(fullfile(dirname,filename_model),'w');
fprintf(File_model,'%s',model);
fclose(File_model);
Since now I want to modify a few parameters each time I run my code, I edited the text file and put format specifier but I don't know how can I print the modified file now.
Is this correct?
model = fileread(fullfile(pathname_model,filename_model));
File_model = fopen(fullfile(dirname,filename_model),'w');
fprintf(File_model,'%s',model, par1, par2, par3, par4);
fclose(File_model);
where par1 to par4 are the first 4 parameter values that I listed at the top.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!