Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = fopen('ficheiro.txt', 'r+');
- text = fgets(file);
- contains_abc = 0;
- while ischar(text)
- disp(text);
- if strfind(text,'abc')
- contains_abc = 1;
- end
- text = fgets(file);
- end
- if contains_abc == 1
- fprintf(file, '\r\n%s', 'xyz');
- end
- fclose(file);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement