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 件のコメント

Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015 年 5 月 7 日
Thanks
Iason Grigoratos
Iason Grigoratos 2016 年 12 月 21 日
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