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일

0 개 추천

You may directly use the strrep function
a = strrep(a, 'def', '');

댓글 수: 2

how can I do it for a 2D array? strrep return 1D cell array

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

추가 답변 (0개)

카테고리

도움말 센터 및 File 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