|
Thank you for your suggestions. I have worked it out. I simply create a new copy of the file I want to edit, then use fwrite to copy/edit all the lines I want.
"Khanh" wrote in message <j5meo5$4ff$1@newscl01ah.mathworks.com>...
> I hope to get help/direction on this.
>
> so I have a 'input.txt' file that contains a line such as:
> command 1
>
> Now, I want to change that value, '1', to something else, for example i=1:1:10, so replacing i for each run, I can save a new input.txt file. I can have
> command 1
> command 2
> ...
> command 10
> I'm not sure what exact matlab command for doing this. Could you suggest some?
>
> Another question is....
> I use fopen(fid,'w') but this create a new file. So I lost all other lines that I don't want to change beside the line 'command 1'. My solution for this is to copying all input.txt to input1.txt and copy all lines from input1.txt to input.txt when I fopen(input, 'w'). Then manually, individually change only the 'command 1' line. Do you know a better solution for this?
>
> Thanks in advanced.
|