Convert cell array of cells into cell array of strings in MATLAB

Posted by yuk on Stack Overflow See other posts from Stack Overflow or by yuk
Published on 2010-04-12T19:22:09Z Indexed on 2010/04/12 19:33 UTC
Read the original article Hit count: 489

Filed under:
|
|
|

Using regexp with tokens on cell array of strings I've got cell array of cells. Here is simplified example:

S = {'string 1';'string 2';'string 3'};
res = regexp(S,'(\d)','tokens')
res = 

    {1x1 cell}
    {1x1 cell}
    {1x1 cell}
res{2}{1}
ans = 
    '2'

I know I have only one match per cell string in S. How I can convert this output into cell arrays of strings in a vectorized form?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about regexp