how to produce a logical matrix using index matrix

2 visualizaciones (últimos 30 días)
Khairul Nur
Khairul Nur el 24 de Oct. de 2019
Editada: per isakson el 24 de Oct. de 2019
Hi, i need some help here, im also new in matlab. i have 'b' containing index matrix for example b=1; i want to create logical matrix and should be [1 0 0 0]
if i have b = 2, the matrix will be [0 1 0 0]. Hope i find some solutions. TQIA

Respuesta aceptada

per isakson
per isakson el 24 de Oct. de 2019
Try
logical_matrix = false( 1, 4 );
logical_matrix( b ) = true;
  3 comentarios
Walter Roberson
Walter Roberson el 24 de Oct. de 2019
DM(i,b) = true;
Khairul Nur
Khairul Nur el 24 de Oct. de 2019
great! its work..thank you very much :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by