MATLAB: Creating a structure array containing names of external files

structure array

Good day , how can I create a function that will receive a structure array containing the names of the external files that will be read in separate field ?

Best Answer

  • As Rik mentioned, it sounds like dir is what you want.
    files = dir(path);
    This will return a structure called 'files' which contains the names of all files in the path location (and other information). To call the specific file you want just do files(index).name.