フィルターのクリア

how to make it into for loop

2 ビュー (過去 30 日間)
arthur doroshev
arthur doroshev 2021 年 4 月 21 日
編集済み: Jan 2021 年 4 月 21 日
Hello,
I am trying to make the below cose into a for loop
Would you help me with that?
file1=load('0.txt','-ascii');
a=file1(:,1);
b=file1(:,2)-r_peak1(1)/1000;
c=file1(:,3);
data=[a,b,c];
save('0.txt','data1','-ascii');
file2=load('3.txt','-ascii');
a=file2(:,1);
b=file2(:,2)-r_peak1(2)/1000;
c=file2(:,3);
data=[a,b,c];
save('3.txt','data1','-ascii');
file3=load('6.txt','-ascii');
a=file3(:,1);
b=file3(:,2)-r_peak1(3)/1000;
c=file3(:,3);
data=[a,b,c];
save('6.txt','data1','-ascii');
file4=load('9.txt','-ascii');
a=file4(:,1);
b=file4(:,2)-r_peak1(4)/1000;
c=file4(:,3);
data=[a,b,c];
save('9.txt','data1','-ascii');
Thank you

採用された回答

Jan
Jan 2021 年 4 月 21 日
編集済み: Jan 2021 年 4 月 21 日
iPeak = 0; % [EDITED]
for k = [0, 3, 6, 9]
name = sprintf('%d.txt', k);
data = load(name, '-ascii');
iPeak = iPeak + 1;
a = data(:,1);
b = data(:,2) - r_peak1(iPeak) / 1000;
c = data(:,3);
data = [a, b, c];
save(name, 'data', '-ascii');
end
  2 件のコメント
arthur doroshev
arthur doroshev 2021 年 4 月 21 日
but what about the r_peak(...)
it should also continue 1,2,3,...
arthur doroshev
arthur doroshev 2021 年 4 月 21 日
ok i worked it out
Thank you very much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by