Open file in folder with numerical ID
Show older comments
The script I'm trying to create should view all the files in a folder and then read the files according to the numerical ID. The reason I'm not using the file name is that the folder contains files which are continuously updated. I get the error: 'The file 'Myfile.spt' could not be opened because: No such file or directory'. The problem seems to be with reading the file, I've also tried using fopen but it doesn't work and gives the contents of the file as only -1.
What I have so far
fileList = dir('C:File_path');
fileList = fileList(~[fileList.isdir]);
[junk, sortorder] = sort([fileList.datenum]);
fileList = fileList(sortorder);
numfiles = numel(fileList);
y = dlmread(fileList(1).name);
Thanks for any help
Accepted Answer
More Answers (0)
Categories
Find more on File Operations 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!