将单元格转换为矩阵

时间:2013-11-25 12:50:22

标签: matlab

我有一个由以下组成的单元格A:

'你好' '世界' '测试'

我想将其转换为矩阵。

我试过

cell2mat(A)

返回

     Error using cat
Dimensions of matrices being concatenated are not consistent.

Error in cell2mat (line 84)
        m{n} = cat(1,c{:,n});

然后我尝试了

 cell2mat(A')

然而,它合并了单个单元格中的所有单词。

建议?

1 个答案:

答案 0 :(得分:5)

A={'hello' 'world' 'test'};
strvcat(A{:})