XML in matlab

  • 2
  • Question
  • Updated 5 years ago
Does anybody know how can we use xmlread in Matlab to read weatherdata from xml?
Photo of esimadmv

esimadmv

  • 1 Post
  • 0 Reply Likes

Posted 6 years ago

  • 2
Photo of Ryton

Ryton

  • 2 Posts
  • 3 Reply Likes
Yes you can! (works for me at least).
In additon, I use xml2struct (http://www.mathworks.com/matlabcentra...) to make a structured file from this xml code and continue from there.

Some examplar code:
"api_example_url = http://api.wunderground.com/api/add-k...
DOMnode = xmlread(api_example_url);
dataset = xml2struct(DOMnode);"

Depending on the type of call, you have to adress the right location in your structure:
dataset.response.hourly_forecast.forecast contains forecasts
dataset.response.history.observations.observation contains historic data
etc