How can I open all xml files?

2 次查看(过去 30 天)
yoghy
yoghy 2014-3-3
回答: Kan-Hua 2014-3-3
Hello,
I´m new in Matlab and I´m trying to open 8 files type xml, but I can´t.For now, Ihave wrotten this script:
% i have 8 files. % example of names: analysis_1245789632. All have the same name and the numbers are consecutives.
numberfiles=8; for indexFiles=1:numberfiles nameFile=['analysis_',num2str(indexFiles,'%10d'),'xml']; dates(indexFiles)=importdata(nameFiles); end
I have the follow error:
Error using importdata. Unable to open file.
Someone can help me??? please!!! I´m very frustrated with this!!

回答(1 个)

Kan-Hua
Kan-Hua 2014-3-3
First, I don't think Matlab's built-in importdata() function can handle XML file. You can use this package to read your xml data:
Also, this line of code
dates(indexFiles)=importdata(nameFiles)
won't work either. Assume you are importing a file that is supported by Matlab, you need to use a cell array to store them, because importadata() returns a matrix. The matrix "dates" cannot store a matrix as its element. You need something like:
dates{indexFiles}=importdata(nameFiles)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by