We want to find out when the goals were scored in a particular soccer game. For each game, we are given a "Goal Event Data" XML string from a soccer database. Your job is to pick out the "Elapsed Time" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.
This translates to finding the number between the "<elapsed>" tags.
Example
Given this input
ged = '<goal><value><elapsed>22</elapsed><subtype>header</subtype></value></goal>'
you should return the number 22.
Note that you must return the number 22 and not the string.
Feature Tip
R2016b introduces string arrays and text manipulation functions which can help. To learn more see MATLAB Characters and Strings.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers126
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2819 Solvers
-
Project Euler: Problem 5, Smallest multiple
1673 Solvers
-
Back to basics 12 - Input Arguments
626 Solvers
-
Return elements unique to either input
814 Solvers
-
Make a run-length companion vector
662 Solvers
More from this Author54
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Perhaps a new problem group dealing with string arrays, character arrays, and cell arrays of character vectors can be added on Cody.
@"Peng Lui": The first Challenge Group involving strings and the like (Strings I) has been posted.