Finding average length of elements in a cell array

In my code I am sorting through a collection of tweets. I have separated out the handles (ex: @Handle) by using the following code.
FID = fopen('Tweets.txt');
Line = fgetl(FID);
while ischar(Line)
%Finds total amount of handles in the tweets%
Handles={};
FileContents = fileread('Tweets.txt');
Handles = length(regexp(FileContents, '@'));
for h = 1;size(Handles);
HandlesString = num2str(Handles);
RegHandles = regexp(HandlesString, '(#)\w+','match');
end
if regexp(Line, '@')>1;
%I
%Displays all Handles in a CELL ARRAY%
HandlesNum = HandlesNum+1;
RegHandles2 = regexp(Line, '(@)\w*', 'match');
CharHandles = char(RegHandles2);
NumHandles = str2num(Char);
HandlesCell = cell(RegHandles2);
disp(HandlesCell)
end
Numbers = [Numbers; Num];
Line = fgetl(FID);
end
What I am now attempting to do is to find the average (mean) length of all the handles in the file. How could I go about this process?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品

提问:

2013-12-3

Community Treasure Hunt

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

Start Hunting!

Translated by