I want to save values from my if statement in an array
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sam17
el 14 de Jun. de 2018
Respondida: Walter Roberson
el 14 de Jun. de 2018
I am trying to save values of the peakInterval which lies in between 550 and 900 to a separate array. I don't know why this code doesn't save the values in the x array. Can you fix the problem?
x=[]
if (peakInterval >= 550) & (peakInterval<=900)
x=peakInterval
end
x(:)=[]
0 comentarios
Respuesta aceptada
Walter Roberson
el 14 de Jun. de 2018
mask = (peakInterval >= 550) & (peakInterval<=900);
x = peakInterval(mask);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Fluid Dynamics en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!