Matlab程序,查看昨天添加的文件是否已再次添加
Matlab中是否有一种有效的方法来检查最近更改的文件夹最近是否再次更改Matlab程序,查看昨天添加的文件是否已再次添加,matlab,Matlab,Matlab中是否有一种有效的方法来检查最近更改的文件夹最近是否再次更改 e、 g.昨天在文件夹X中添加了一个文件Y。如果今天文件Z被添加到相同的位置,那么这是正确的,如果它没有被添加,那么生成raise error标志。如果文件夹A在数天/数周内没有添加文件,则添加了文件B,同时升起一个标志。假设您知道要签入的文件夹“如果没有,您可以采用相同的方法” 所以进入文件夹本身 d=now % gets current time and date A=dir; % get all the files
e、 g.昨天在文件夹X中添加了一个文件Y。如果今天文件Z被添加到相同的位置,那么这是正确的,如果它没有被添加,那么生成raise error标志。如果文件夹A在数天/数周内没有添加文件,则添加了文件B,同时升起一个标志。假设您知道要签入的文件夹“如果没有,您可以采用相同的方法” 所以进入文件夹本身
d=now % gets current time and date
A=dir; % get all the files inside the folder you can add masks to search for specific files
A(1:2)=[]; % remove . and ..
% now to sort files according to last modified
S=[A(:).datenum];
[S,ix]=sort(S,'descend');
B=A(ix); % sorted files
% now you only need to check the last couple of modified files
if d-B(1).datenum>1 % if the last modified file is older than 1 day
flag=1;
end
if B(1).datenum-B(2).datenum > 1 % for the second case if a new file was added to a folder that hasn't been updated in a while
flag=1;
end
在哪种情况下?在每一次Maltab的启动时,还是在你自己的某个活动期间?@citizensemane在我自己的活动期间,该活动将设置为每天在指定时间运行一次