How to have Matlab read files and then record the title of the file as a variable?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi everyone,
I have a set of files in a folder, like:
58.94177000.dpmrpt
62.586.dpmrpt
67.5467700.dpmrpt
77.331770000.dpmrpt
I need to read each file in Matlab, and record the title of the file like 77.331770000 as a variable, because it is a time variable.
Thank you.
댓글 수: 0
채택된 답변
Walter Roberson
2022년 4월 10일
S = {'58.94177000.dpmrpt', '62.586.dpmrpt'}
[~, timepart, ~] = fileparts(S)
댓글 수: 3
Walter Roberson
2022년 4월 10일
projectdir = 'D:\data';
ext = ".dpmrp";
dinfo = dir(projectdir, "*" + ext);
filenames = fullfile({dinfo.folder}, {dinfo.name});
nfiles = length(filenames);
[~, timepart, ~] = fileparts(filenames);
for K = 1 : nfiles
thisfile = filenames{K};
thisdata = Function_To_Read_dpmrp_File_Goes_Here(thisfile);
results = Function_To_Process_Data_Goes_Here(thisdata);
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Object Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!