How can I open all xml files?
2 views (last 30 days)
Show older comments
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!!
0 Comments
Answers (1)
Kan-Hua
on 3 Mar 2014
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)
0 Comments
See Also
Categories
Find more on Workspace Variables and MAT-Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!