how to produce a logical matrix using index matrix

1 vue (au cours des 30 derniers jours)
Khairul Nur
Khairul Nur le 24 Oct 2019
Modifié(e) : per isakson le 24 Oct 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

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by