Output matrix dimension mismatch in for loop
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!