A convenient helper here cellfun, with the right option for displaying non-scalar data - we tell him to start sortalternately for each element of the cell array:
>> a = {'dcb' 'aetk' 'acb'}
a =
{
[1,1] = dcb
[1,2] = aetk
[1,3] = acb
}
>> b = cellfun(@sort, a, 'UniformOutput', false);
b =
{
[1,1] = bcd
[1,2] = aekt
[1,3] = abc
}
source
share