How do I read multiple text files and use its data for mathematical Calculation?

2 Ansichten (letzte 30 Tage)
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.

Antworten (1)

Walter Roberson
Walter Roberson am 15 Sep. 2021
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.

Kategorien

Mehr zu Signal Processing Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by