Filter löschen
Filter löschen

Replace multiple values

3 Ansichten (letzte 30 Tage)
Lusine
Lusine am 12 Mai 2012
Hi everyone I need to replace multiple values to one but when using strrep function I have to do this many times and specify oldSubstr one at a time, is there a method to do this in a more convinient way.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 12 Mai 2012
use function regexprep
eg:
c = {'c:\cookies.m'; ...
'c:\candy.m'; ...
'c:\calories.m'};
d = regexprep(c, {'co' 'can' 'cal'}, 'N_')

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by