MATLAB: Can we sum lastletter of string

lastletterMATLABsum

i have data with
A = 111n22
B = 444m11
C = 777n55
I want select last letter of A B and C and then sum it. Pls help me!

Best Answer

>> A = '111n22';
>> B = '444m11';
>> C = '777n55';
>> sum(str2double(regexp({A,B,C},'\d$','match','once'))) % single
ans = 8
Or perhaps:
>> sum(str2double(regexp({A,B,C},'\d+$','match','once'))) % multiple
ans = 88