How do I read multiple text files and use its data for mathematical Calculation?
1 次查看(过去 30 天)
显示 更早的评论
I have approximately 60 files for input signal and 60 files for Reference signal and I need the values stored in these files to calculate Transmission coeffiecient wrt time. Files contain data as follow
0, 102
2,11
and so on.
It will be great if someone can help me out.
0 个评论
回答(1 个)
Walter Roberson
2021-9-15
ext = '.txt'; %extension of files
dinfo = dir("*" + ext);
filenames = {dinfo.name};
nfiles = length(filenames);
all_data = cell(nfiles,1);
for K = 1 : nfiles
thisfile = filenames{K};
thisdata = load(thisfile);
all_data{K} = thisdata;
end
The data is now in the cell array all_data .
Or you could process the data as you read it.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Processing Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!