How to add a title to each column/ row in matrix?

4 次查看(过去 30 天)
I have a cell array which displays a word and the number of times it occurs in a file. for example:
'take' [7]
'the' [2]
I would like to add a title to each line so it looks like this
Word: 'take' Count: [7]
Word: 'the' Count: [2]
Any Ideas

回答(1 个)

Jan
Jan 2015-4-6
Where should these titles appear?
Perhaps this helps:
C = {'take', [7]; 'the', [2]};
Ct = C.';
fprintf('Word: %-20s Count: %d\n', Ct{:})

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by