How to replace different variables with a single variable in a text file?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tiasa Ghosh
el 14 de Mayo de 2018
Comentada: Tiasa Ghosh
el 15 de Mayo de 2018
Hello everybody! I am not so used to editing and working with .txt files in MATLAB. I am looking for ways to replace multiple set of characters like '=' , '+', '-' with any single character like '%'. I guess I need to use regexprep for this purpose, but I am not able to figure it out for the .txt file. Any help will be appreciated. Thanks
2 comentarios
Bob Thompson
el 14 de Mayo de 2018
What do you mean by not being able to figure it out for the .txt file?
Respuesta aceptada
Akira Agata
el 15 de Mayo de 2018
Here is a simple example on how to use regexprep to replace '=','+','-' with '%'.
strIn = 'Please replace multiple set of characters like =, +, - with %';
strOut = regexprep(strIn,'[=+-]','%');
The result becomes:
>> strOut
strOut =
'Please replace multiple set of characters like %, %, % with %'
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Variables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!