Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Create a vector that gives the information about the locations of each element

1 visualización (últimos 30 días)
Ismaeel
Ismaeel el 29 de Dic. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have the vector A: A=[1 3 7], and I want to create another array, say B, that contains the locations of the elements of A. That is, B=[1 0 1 0 0 0 1] Thanks

Respuestas (1)

KSSV
KSSV el 29 de Dic. de 2016
Editada: KSSV el 29 de Dic. de 2016
A=[1 3 7] ;
B = zeros(1,max(A)) ;
B(A) = 1
Or Straight away
B(A) = 1

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by