help on if statement
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How can I use a if loop to display where X4(n,1)>X4(n,2)>X4(n,3)>X4(n,4)>X4(n,5) == 1 n = 1:31 I want it to show where this is true in the matrix or should i use a while loop?
1 comentario
Respuesta aceptada
Honglei Chen
el 1 de Nov. de 2011
You can vectorize this in one command:
idx = 1:31;
find( (X4(idx,1)>X4(idx,2))&(X4(idx,2)>X4(idx,3))&(X4(idx,3)>X4(idx,4))&(X4(idx,4)>X4(idx,5))&(X4(idx,5)==1))
HTH
2 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!