Cody

# Problem 43658. When Was That Goal Scored?

Solution 1265822

Submitted on 10 Sep 2017 by Richard Blair
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   Pass
ged = '<goal><value><elapsed>47</elapsed><subtype>header</subtype></value></goal>'; elapsed = getElapsedTime(ged); elapsed_correct = [47]; assert(isequal(elapsed,elapsed_correct))

y = cell '47'

2   Pass
ged = '<goal><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><event_incident_typefk>406</event_incident_typefk><elapsed>22</elapsed><player2>38807</player2><subtype>header</subtype><player1>37799</player1><sortorder>5</sortorder><team>10261</team><id>378998</id><n>295</n><type>goal</type><goal_type>n</goal_type></value><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><event_incident_typefk>393</event_incident_typefk><elapsed>24</elapsed><player2>24154</player2><subtype>shot</subtype><player1>24148</player1><sortorder>4</sortorder><team>10260</team><id>379019</id><n>298</n><type>goal</type><goal_type>n</goal_type></value></goal>'; elapsed = getElapsedTime(ged); elapsed_correct = [22;24]; assert(isequal(elapsed,elapsed_correct))

y = 2×1 cell array '22' '24'

3   Pass
ged = '<goal><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><event_incident_typefk>406</event_incident_typefk><elapsed>73</elapsed><player2>25668</player2><subtype>header</subtype><player1>38755</player1><sortorder>2</sortorder><team>10194</team><id>465096</id><n>321</n><type>goal</type><goal_type>n</goal_type></value></goal>'; elapsed = getElapsedTime(ged); elapsed_correct = [73]; assert(isequal(elapsed,elapsed_correct))

y = cell '73'

4   Pass
ged = '<goal><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><event_incident_typefk>393</event_incident_typefk><elapsed>3</elapsed><player2>24635</player2><subtype>shot</subtype><player1>37139</player1><sortorder>3</sortorder><team>8650</team><id>468555</id><n>239</n><type>goal</type><goal_type>n</goal_type></value><value><comment>o</comment><stats><owngoals>1</owngoals></stats><event_incident_typefk>115</event_incident_typefk><elapsed>69</elapsed><player1>30617</player1><sortorder>3</sortorder><team>8650</team><id>468934</id><n>304</n><type>goal</type><goal_type>o</goal_type></value><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><elapsed_plus>1</elapsed_plus><event_incident_typefk>393</event_incident_typefk><elapsed>90</elapsed><player2>23949</player2><subtype>shot</subtype><player1>40755</player1><sortorder>2</sortorder><team>8586</team><id>469035</id><n>328</n><type>goal</type><goal_type>n</goal_type></value></goal>'; elapsed = getElapsedTime(ged); elapsed_correct = [3; 69; 90]; assert(isequal(elapsed,elapsed_correct))

y = 3×1 cell array '3' '69' '90'

5   Pass
ged = '<goal><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><elapsed>11</elapsed><subtype>shot</subtype><team>8472</team><id>507018</id><n>250</n><type>goal</type><goal_type>n</goal_type></value><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><elapsed>18</elapsed><subtype>header</subtype><team>8559</team><id>507106</id><n>255</n><type>goal</type><goal_type>n</goal_type></value><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><elapsed>21</elapsed><subtype>shot</subtype><team>8559</team><id>507142</id><n>259</n><type>goal</type><goal_type>n</goal_type></value><value><comment>dg</comment><elapsed>30</elapsed><subtype>shot</subtype><team>8472</team><id>507259</id><n>148</n><type>goal</type><goal_type>dg</goal_type></value><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><elapsed>39</elapsed><subtype>shot</subtype><team>8559</team><id>507390</id><n>278</n><type>goal</type><goal_type>n</goal_type></value><value><comment>n</comment><stats><goals>1</goals><shoton>1</shoton></stats><elapsed>55</elapsed><subtype>shot</subtype><team>8559</team><id>507734</id><n>295</n><type>goal</type><goal_type>n</goal_type></value></goal>'; elapsed = getElapsedTime(ged); elapsed_correct = [11; 18; 21; 30; 39; 55]; assert(isequal(elapsed,elapsed_correct))

y = 6×1 cell array '11' '18' '21' '30' '39' '55'

### Community Treasure Hunt

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

Start Hunting!