Search code examples
stringmatlabcharuppercaselowercase

matlab change upper case character to lower case character in string


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


Solution

  • 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.