How can I open all xml files?

2 Ansichten (letzte 30 Tage)
yoghy
yoghy am 3 Mär. 2014
Beantwortet: Kan-Hua am 3 Mär. 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!!

Antworten (1)

Kan-Hua
Kan-Hua am 3 Mär. 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)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by