Cody

# Problem 1949. Get top 5 Cody Player Emails Automatically

Solution 1038531

Submitted on 30 Oct 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
% My code is below, it's used to generate the expected result. %Read in the player page playerPage=urlread('http://www.mathworks.com/matlabcentral/cody/players'); %Find where the web address for each profile starts startIdx=strfind(playerPage,'<div class="grid_53 push_3">')+104; %Initialize output array emails={}; %Get top 5 only for i=1:5 % Get the profile page link tempStr=playerPage(startIdx(i):startIdx(i)+100); quoteIdx=strfind(tempStr,'"')-1; profilePageLink=['http://www.mathworks.com' tempStr(1:quoteIdx(1))]; profilePage=urlread(profilePageLink); % Try and find mailto link tStartIdx=strfind(profilePage,'mailto'); %If you could find it if ~isempty(tStartIdx) % Get the email tEndIdx=strfind(profilePage(tStartIdx:tStartIdx+100),'"')+tStartIdx; % Add it to our cell array emails{length(emails)+1}=profilePage(tStartIdx+7:tEndIdx-2); end end tic yourResponse=getCodyEmails() timeElapsed=toc assert(isequal(yourResponse,emails)) assert(isequal(1,timeElapsed>3))

Index exceeds matrix dimensions. Error in TestPoint1 (line 15) tempStr=playerPage(startIdx(i):startIdx(i)+100);