-2

I have a cell array which contains strings like this :

Input = { 'BDCE'; 'BAFD'; 'HGAB' }

How can I change order of characters in each string in a cell array? The order is from 'A' to 'Z' The expected output should be like this :

Output = {'BCDE'; 'ABDF'; 'ABGH'}
TylerH
  • 20,799
  • 66
  • 75
  • 101
kgk
  • 649
  • 1
  • 10
  • 23

1 Answers1

3

That's easy: use cellfun to apply the sort function to the string contained in each cell:

Output = cellfun(@sort, Input, 'Uniformoutput', 0);
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147