MATLAB: String Copying without Spaces

strings

i have a string a= [a b c d] separated by two spaces n i want to copy it in another string like b=[abcd] by removing the spaces. Please help.

Best Answer

a = 'a b c d'
b = regexprep(a,' ','')
or
b = setdiff(a,' ')
or
b = f(~ismember(a,' '))
or
b = strrep(a,' ','')