cellstr()的反转是什么?

时间:2014-06-24 20:51:04

标签: matlab

我有:

S = ['abc '; 'defg'; 'hi  '];  % S is a 3x4 char
c = cellstr(S)                 % c is a 3x1 cell

c = 

    'abc'
    'defg'
    'hi'

我如何从c获得S?也就是说,cellstr()的倒数是什么?

1 个答案:

答案 0 :(得分:2)

您可以使用char(c)

S = ['abc '; 'defg'; 'hi  '];  % S is a 3x4 char
c = cellstr(S)                 % c is a 3x1 cell

c = 

    'abc'
    'defg'
    'hi'

S2 = char(c)                        % S2 is a 3x4 char 
all(all(S == S2))

ans =

     1                            % S and S2 are identical