importing xml and change to mat stuct
Show older comments
Hello,
I am trying to import multiple *.xml files from specific location and change them into mat structure files but I am facing some problems. This is my code:
if true
% code
end
%loading files from device
filedir= 'X:\GD\EA\ASP\Interest_groups\test\test_export.xml\pilot_studies'; %location of the files
file = dir(fullfile(filedir, '*.xml'));
mfiles=length(file); %number of files in the specified folder
for i = 1: mfiles
fid(i)=fopen(fullfile(filedir, file(i).name),'rt');
s{i}=textscan(fid(i), '%s', 'delimiter','\n');
fclose(fid(i));
end
S = xml2struct(s)
It basically gives me the error in the last line saying that the first input to exist must be a string scalar or a character vector. My s variable is 1x3 cell which is weird. I am not sue how to solve it. I would appreciate your help.
K
1 Comment
Accepted Answer
More Answers (1)
KDRA
on 10 Oct 2018
0 votes
Categories
Find more on Structured Data and XML Documents 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!