Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extracting data from within xml files using MATLAB

Tags:

file-io

matlab

I am a complete programming beginner trying to learn MATLAB. I want to extract numerical data from a bunch of different xml files. The numerical data items are bounded by the tags and . How do I write a program in MATLAB?

My algorithm:

1. Open the folder
2. Look into each of 50 xml files, one at a time
3. Where the tag <HNB.1></HNB.1> exists, copy numerical contents between said tag and write results into a new file
4. The new file name given for step 3 should be the same as the initial file name read in Step 2, being appended with "_data extracted"

example:

FileName = Stewart.xml
Contents = blah blah blah <HNB.1>2</HNB.1> blah blah
NewFileName = Stewart_data extracted.txt
Contents = 2
like image 364
Stewart Wise Avatar asked Jul 15 '11 12:07

Stewart Wise


1 Answers

The fundamental function in MATLAB to read xml data is xmlread; but if you're a complete beginner, it can be tricky to work with just that. Try this series of blog postings that show you how to put it all together.

like image 70
Edric Avatar answered Nov 15 '22 07:11

Edric