- Write a "template" Mfile, which is complete except for that line. On that line put a unique string, such as XXX.
- Write another "lines" file, containing every version of that replacement line that you want to use.
- Read one line of the "lines" file, e.g. newline = fgetl(..).
- Read the template file into a variable, e.g. str = fileread(..).
- Use string functions to find and replace that line, e.g. strrep(str,'XXX',newline).
- save the changed variable in a new file (remember it needs a new name).
