MATLAB: How to select the first letter of every word

string

I have no idea how I would go about doing this
Input: I like eating pizza Output: Ilep

Best Answer

str='I like eating pizza';
str2=cellfun(@(c) c(1),strsplit(str))