How can I open all xml files?

2 vues (au cours des 30 derniers jours)
yoghy
yoghy le 3 Mar 2014
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!!

Réponses (1)

Kan-Hua
Kan-Hua le 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)

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by