I have a 4902x1 cell array which contains strings like Blue. or Green. I want to replace a number of these strings with another word. How can this be done in MATLAB?
For instance find
Blue.
Red.
Green.
Replace with:
Colour.
Edit:
strArray = {'green.','black.'};
strMatch = strmatch(strArray, Book2);
strArray( strMatch(str,strArray)) = {'colour'};
If you have a cell array of strings (in your example strArray is not a cell array) I would define a small function to do the logic and then use
cellfun:Then you can get your new array with: