필터 지우기
필터 지우기

replace the string a cell array with empty cell

조회 수: 3 (최근 30일)
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015년 5월 7일
댓글: Iason Grigoratos 2016년 12월 21일
I have a cell array a = {'abc' ; 'def' ; 'ghi' ; 'def' ; 'xyz'}
I need to replace a 'def' with empty cell.
so my answer should be a = {'abc' ; '' ; 'ghi' ; '' ; 'xyz'}
How can i do this using cell function?
thank you

채택된 답변

Nobel Mondal
Nobel Mondal 2015년 5월 7일
You may directly use the strrep function
a = strrep(a, 'def', '');
  댓글 수: 2
Iason Grigoratos
Iason Grigoratos 2016년 12월 21일
how can I do it for a 2D array? strrep return 1D cell array

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by