2

I want to read some "xlsx" & "txt" files from directory and process on that. Names of the files are the random word. so I used a function(getAllFiles) to obtain all directions of those files which I founded in this link: How to get all files under a specific directory in MATLAB?. when I want to use those direction in dlmread or xlsread it give an error as bellow:

 ??? Error using ==> dlmread at 55
 Filename must be a string.

the code is as follow :

fileList =  getAllFiles('/home/Network/econimi/SSS')
A=dlmread(fileList(2));

how can I convert fileList to the string format?

Community
  • 1
  • 1

1 Answers1

0

The output of getAllFiles is a cell array. As stated in the manual 'Cell array indices in smooth parentheses refer to sets of cells' which means fileList(2) is a cell as well. To access an element of a cell array, use curvy brackets.

Try:

A=dlmread(fileList{2});
Cape Code
  • 3,584
  • 3
  • 24
  • 45