I have a cell array containing 750 "documents" (750 arrays of words within the single cell array). I am trying to concatenate all of the words to make a single array. So far I know I need to use a for loop to iterate through each array and append to the end of the last one, however my code is giving me the wrong answer:
list = cell(1,1);
for i = 1:length(docs)
prevList = list;
list = [prevList;docs{i}];
end
My thoughts are that my initialisation of list is incorrect as it produces:
[1x1635 char]
[1x1476 char]
[1x531 char]
[1x103 char]
[1x1725 char]
[1x344 char]
[1x463 char]
[1x739 char]
[1x762 char]
[1x1139 char]
[1x89 char]
[1x361 char]
[1x334 char]
[1x520 char]
[1x219 char]
and so forth...
as opposed to a list of words.
If anyone could help me, I would very much appreciate it.
doc{i}contain exactly? Is it a char vector, or a cell array? Can you give a small example for two or three documents with a few words each?[1x1635 char]is just Matlab's way of shortening a string inside a cell that is too long to print out to the command window. If the line was fewer that 80 characters (I believe -or whatever your preference is set to) then the actual string would be shown.class(doc{1})? If my answer works then it should bechar. You may be confusing the elements of a cell array (indexed with{}brackets) with the cells themselves.