XML in matlab

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


  • 1 Post
  • 0 Reply Likes

Posted 8 years ago

  • 2
Photo of 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