Info
This question is closed. Reopen it to edit or answer.
How to calculate mean of amplitudes from many time vs amplitude ascii text files
1 view (last 30 days)
Show older comments
Hello,,
I have 100 ascii text file in same format (names are R01.txt, R02.txt,.......R100.txt). Every file contains 2 colums with 9000 rows. First colum represents time(sec) and it is the same for 100 files also. Second colum represents amplitude values (in cm/sec). In the case of having no so much data file, I can do it. For example if I have 3 files, I can calculate the mean as following without any need of using for loop etc.:
data1=load ('R01.txt');
data2=load ('R02.txt');
data3=load ('R03.txt');
time=data1(:,1); %The same for every file
amp1=data1(:,2);
amp2=data2(:,2);
amp3=data3(:,2);
mean=(amp1(1:9000)+amp2(1:9000)+amp3(1:9000))/3;
plot(time,mean')
But now, I have 100 text files and I want to calculate the mean of amplitudes from all 100 text files. Then I can plot the result (amplitude versus time).
I will be glad if you can help about this script.
Thank you
0 Comments
Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!