String 将字符串列追加到数字列

String 将字符串列追加到数字列,string,matlab,concatenation,cell-array,String,Matlab,Concatenation,Cell Array,在MATLAB中,如何将字符串列附加到数字列 例如,我有字符串列wrds,数字列出现 wrds={'the' 'of' 'to' 'and'}'; occurs=[103 89 55 20]'; 我想把它们并排放在一起,这样它们就会像这样显示: 'the' 103 'of' 89 'to' 55 'and' 20 你可能会觉得这会起作用: out={wrds occurs} 但当我输入时得到的输出是: out = {4x1 cell} [4x1 double] 这跟我没

在MATLAB中,如何将字符串列附加到数字列

例如,我有字符串列
wrds
,数字列
出现

wrds={'the' 'of' 'to' 'and'}'; occurs=[103 89 55 20]';
我想把它们并排放在一起,这样它们就会像这样显示:

'the' 103
'of'   89
'to'   55
'and'   20
你可能会觉得这会起作用:

out={wrds occurs}
但当我输入时得到的输出是:

out =
{4x1 cell}    [4x1 double]

这跟我没什么关系。如何才能看到字符串和数字的实际显示?

将数字数组转换为单元格数组并连接:

>> out = [wrds(:) num2cell(occurs)]
out = 
    'the'    [103]
    'of'     [ 89]
    'to'     [ 55]
    'and'    [ 20]

作为
num2cell
的快速替代方案,我建议
sprintfc
out=[wrds(:)sprintfc('%d',发生(:)]

现在我得到了:out={4x1 cell}{4x1 cell}啊,是的,我的错了。谢谢