Ahora está siguiendo esta publicación
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
This utility will replace all string matches in the target files with a given string. This is similar to 'Replace all' in the editor, except that it can be used programmatically and on multiple files.
For instance, to replace all occurrences of 'abs' with 'mag':
>> find_and_replace('my_file.m', 'abs', 'mag')
Both the "match" and "replace" inputs can be regular expressions. For instance, we can replace all calls to sqrt(...) with my_sqrt(...), keeping the function's argument by using regular expressions.
>> find_and_replace(file_names, 'sqrt\((.*?)\)', 'my_sqrt\($1\)');
For more examples:
>> help find_and_replace;
Some knowledge of regular expressions is helpful, but not required, to use this tool. See 'Regular Expressions' in MATLAB's documentation.
Citar como
Tucker McClure (2026). Find and Replace in Files (https://es.mathworks.com/matlabcentral/fileexchange/42877-find-and-replace-in-files), MATLAB Central File Exchange. Recuperado .
Agradecimientos
Inspiración para: strrepfile
Información general
- Versión 1.1.0.1 (3,79 KB)
Compatibilidad con la versión de MATLAB
- Compatible con cualquier versión
Compatibilidad con las plataformas
- Windows
- macOS
- Linux
