【发布时间】:2014-10-22 06:27:01
【问题描述】:
如何遍历文件夹中的.dbl and.txt 文件,找到具有特定编号和条件(例如“激光开启”)的.txt 文件,然后对关联的.dbl 文件执行操作(如果名字相似)?
我真的没有太多,我似乎无法使用getfield(files, 'name') 访问我想要查看的文件名,所以我真的被卡住了。这是我到目前为止所掌握的内容,以便为我的问题提供更多结构。
% specify folder with the load function to manipulate .dbl files
folder = 'some folder';
% specify folder that has the data
folder2 = 'some other folder';
cd(folder);
addpath(folder2);
% specify parameters implemented in data collection program
start_delay = 0; % in ps
step_size = 20; % in ps
n_steps = 30;
% loop through folders
files = dir(folder2);
for i = 1:size(files,1)
if i == '*.txt
% find string 'ON'
% find a number in .txt file
% for .txt files with string 'ON', look for .txt files for delay =0, then 20, then 40, etc.
% find associated .dbl file
% manipulate .dbl file
end
end
【问题讨论】: