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)