Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
515 views
in Technique[技术] by (71.8m points)

extracting data from within xml files using 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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...