MATLAB: Remove specific entry in a cell array

cell array remove entry loop

I want to remove an entry in a cell array if it is equal to something specifically. Explained in this example:
animals={'cat', 'dog', 'mouse', 'horse'};
"animals" is being redefined in a loop, and if it happens to be redefined with 'dog' as an entry, I want to remove it. So I want
animals={'cat', 'mouse', 'horse'};
I don't want to replace 'dog' with a blank (''), I want to remove that entry entirely and keep the array tight (i.e. reduce the dimensions from 4×1 to 3×1 in this case).
Thanks

Best Answer

animals(ismember(animals,'dog')) = [];