suppose I have a string mystr='Tom and Jerry' I want to write a function that removes all the spaces and leaves just one space in between each word. So I would want the outcome to be 'Tom and Jerry' I used mystr=mystr(~isspace(mystr)) and got TomandJerry but how would I include one space in bettween each word? Thank you
MATLAB: Removing multiple blanks for a string
blankisspaceMATLABspacestrings
Related Question
- Regexprep() skip first occurrence
- Why is a blank ignored in strcat
- I have a string with the form of that of what you would write to initialize a matrix; how to make the string a matrix
- How to remove certain characters from a string in a file
- How to search through a character array with another character that has optional words
Best Answer