converting a double array to a logical array conditionally
Mostrar comentarios más antiguos
Double array A is [2 1 6 7 3 5 4]. How can I convert it to a logical array in a way to get 1 for the first (for example) 3 elements and 0 for the rest. i.e., B = [1 1 0 0 0 1 0]. I apologize for the very basic nature of this question but unfortunately couldn't find any answer for it!
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 16 de Jun. de 2015
B = A <= 3;
Categorías
Más información sobre Logical 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!