0
votes

If I have this element type "char":

A=['abc';'dei';'fgh'];

And I want to obtain something like:

B=somefuntion(A)

And obtain something like this:

B={'abs';'dei';'fgh'}

I tried this function called char2cell, but the result was this:

B = 'adfbegcih';

I really appreciate any help, thanks!

1

1 Answers

2
votes

You can use mat2cell:

 F=mat2cell(A,ones(size(A,1),1),size(A,2))

The code splits every row into one cell(ones(size(A,1),1)) and keeps the columns together (size(A,2))