フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

averagin over parts of a file

1 回表示 (過去 30 日間)
eFKa
eFKa 2014 年 6 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi everyone,
i have a large txt file of the following form; first column representing time and the second column mass of particles
if true
% code
%example.txt
3.53501,20.1797
3.716,20.1797
3.53029,20.1797
5.65082,40.3594
5.59342,40.3594
5.97809,40.3594
.
.
.
end
i want to average over the first three numbers of the first column put the average in the first column of a file and the mass in the second column. i have done this for one type of mass, as following
if true
% code#
D=load('time.txt');
Average_time=sum(D(:,1))/size(D,1)
Average_time(2)=D(1,2)
end
my difficulty is to do the same over a file with different masses as in example.txt. I couldnt figure out an elegant for-loop (actually any loop ) Any suggestions? thanks in advance
cheerz

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by