필터 지우기
필터 지우기

Replace multiple values

조회 수: 3 (최근 30일)
Lusine
Lusine 2012년 5월 12일
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.
  댓글 수: 1
Andrei Bobrov
Andrei Bobrov 2012년 5월 12일
your example

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 5월 12일
use function regexprep
eg:
c = {'c:\cookies.m'; ...
'c:\candy.m'; ...
'c:\calories.m'};
d = regexprep(c, {'co' 'can' 'cal'}, 'N_')
  댓글 수: 1
Lusine
Lusine 2012년 5월 12일
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by