Open file in folder with numerical ID
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!