Use lower()
:
a = lower(a);
If you only need to change the first letter to upper case, try the following:
a = [lower(a(1)) a(2:end)];
Check out here for more info.
Frage
I would like to take a string and change the first letter of that string from upper to lower case in MATLAB. Any suggestions.
Example:
a = 'Upper';
% Do something to a
a = 'upper'
thank you in advance
Lösung
Use lower()
:
a = lower(a);
If you only need to change the first letter to upper case, try the following:
a = [lower(a(1)) a(2:end)];
Check out here for more info.
Andere Tipps
If you want all the letters to be lower case, then
s = 'String'
lowercase(s)
gives
string
If you want only the first letter, then
s = 'STring'
[lower(s(1)) s(2:end)]
gives
sTring