我是一个完整的编程初学者,正在尝试学习 MATLAB。我想从一堆不同的 xml 文件中提取数值数据。数值数据项由标签和 界定。如何在 MATLAB 中编写程序?
我的算法:
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"
例子:
FileName = Stewart.xml
Contents = blah blah blah <HNB.1>2</HNB.1> blah blah
NewFileName = Stewart_data extracted.txt
Contents = 2
最佳答案
MATLAB 中读取 xml 数据的基本函数是 xmlread ;但是如果您是一个完全的初学者,那么使用它可能会很棘手。尝试 this series of blog postings向您展示如何将它们组合在一起。
关于matlab - 使用 MATLAB 从 xml 文件中提取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6706980/