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.

 Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 12 Mai 2012

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Design Verifier dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by