MATLAB: I have a cell array that it has number and character. The first part of the cell inlcludes numbers but the the length is varying. The second part is always a letter, but it can vary.I am going to dived numbers and the letter.

cell arrays

c={'123.45e','1.23456A'} I wanf to have cc={'123.45','e','1.23456','A'}

Best Answer

Here are two simple methods.
It is easy to use regexp to achieve this:
>> c = {'123.45e','1.23456A'};
>> D = regexp(c,'(\d+\.\d+)(.+)','tokens','once');
>> D = vertcat(D{:})
D =
'123.45' 'e'
'1.23456' 'A'
Or if the letter is always just one character (and never multiple letters) then you could simply use indexing:
>> D = cellfun(@(s){s(1:end-1),s(end)},c,'Uni',0);
>> D = vertcat(D{:})
D =
'123.45' 'e'
'1.23456' 'A'