How to save answers from a Loop in one Matrix Column Wisw
2 ビュー (過去 30 日間)
古いコメントを表示
Hi Guys,
I am attaching the code below if someone can help me, I am running a file in loop,
The output of the loop will be as follows:
Output 1:
2
4
5
4
5
Output 2:
1
2
3
4
5
I want to save both the outputs in a single matrix as: Output 1 Output 2
It want my matrix to be as:
2 1
4 2
5 3
4 4
5 5
for S = 0.25:0.25:100;
T = 1650*S;
C1 = mean(LeadingTip(1:T));
C2 = mean(TrailingTip(1:T));
LT = LeadingTip(1:T);
TT = TrailingTip(1:T);
T1 = (1/Fs:1/Fs:S);
maxlag1 = 100;
cor_seq25 = xcorr([LT-C1],[TT-C2],maxlag1,'coeff'); %I want to save Cor_seq running in loop, as a matrix column wise
end
0 件のコメント
回答 (1 件)
VBBV
2021 年 4 月 18 日
S = 0.25:0.25:100;
for i = 1:length(S)
T = 1650*S(i);
C1 = mean(LeadingTip(1:T));
C2 = mean(TrailingTip(1:T));
LT = LeadingTip(1:T);
TT = TrailingTip(1:T);
T1 = (1/Fs:1/Fs:S);
maxlag1 = 100;
cor_seq25(:,i) = xcorr([LT-C1],[TT-C2],maxlag1,'coeff'); %I want to save Cor_seq running in loop, as a matrix column wise
end
Try this
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!