MATLAB: Replace the string a cell array with empty cell

replacing string with empty cell

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

Best Answer

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