MATLAB: How to split a string and assign new values to the strings

look up tablestrings

If if want to change the string
str='Hello'
Into a new string with the values
str='Hotel-Echo-Lima-Lima-Oscar'
How do I do that?

Best Answer

This is even simpler, using the newly introduced replace (R2016b):
natoLookup = {'h','Hotel-';
'e','Echo-';
'l','Lima-';
'o','Oscar-';
};
replace(lower('Hello'), natoLookup(:, 1), natoLookup(:, 2))