Output matrix dimension mismatch in for loop
이전 댓글 표시
Hi guys, I am having problem with storing the peaks of my data in a for loop. It said subscripted assignment dimension mismatch. I am guessing may be the number of peaks is not the same for all the values in the loop. Here is a simplified version of my codes:
q = 0;
g= 0;
for A = 0:pi/2:4*pi;
for B = 1:1:10;
y(q+1) = sin(A*B);
H(q+1) = B;
q = q+1;
end
q = 0;
C(g+1,:) = y;
[pks,locs] = findpeaks(C(g+1,:));
D(g+1,:) = pks;
E(g+1,:) = B(locs);
g = g+1;
end
plot(H,y)
g = 0;
How can I store my peaks and the corresponding x values?
Thanks guys!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!