can anyone help me to understand how can i pre-allocate the output that I get in "statuses" (statuses is a Nx1 cell, where each cell is 1x1 struct) in order to increase the speed of the code? (tic-toc around 57sec)
thank you in advance!
tweetquery = 'hello';
s = search(c,tweetquery,'count',100);
statuses = s.Body.Data.statuses;
%
while isfield(s.Body.Data.search_metadata,'next_results')
nextresults = string(s.Body.Data.search_metadata.next_results);
max_id = extractBetween(nextresults,"max_id=","&");
cmax_id = char(max_id);
s = search(c,tweetquery,'count',100,'max_id',cmax_id);
statuses = [statuses;s.Body.Data.statuses];
end