Using nested for loop to create a 3D matrix ?
1 回表示 (過去 30 日間)
古いコメントを表示
Perrine Cristante
2018 年 6 月 6 日
回答済み: Perrine Cristante
2018 年 6 月 7 日
Hello,
I have an ECG signal to parse to find values corresponding to a certain time window. The start and stop times of the window are respectively stored in QRSavgd and QRSavgf. X is my time scale.
B = [];
X = samples*1000/f;
A = horzcat(ECG(:,1:12),X.');
for i = 1:length(QRS)
for j = 1:length(ECG)
if A(j,13)>=QRSavgd(i) && A(j,13)<=QRSavgf(i)
B(:,:,j) = vertcat(B,A(j,:));
% plot(B);
end
end
end
I would like to store each B array found with the j loop in a 3D matrix so that I can differentiate each iteration of the j loop, to know which values I get when j=1, j=2...
Thanks
2 件のコメント
Stephen23
2018 年 6 月 6 日
It does not make much sense to use both concatenation and indexing to collect your values:
B(:,:,j) = vertcat(B,A(j,:));
What are you hoping to achieve?
採用された回答
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!