how to produce a logical matrix using index matrix

1 回表示 (過去 30 日間)
Khairul Nur
Khairul Nur 2019 年 10 月 24 日
編集済み: per isakson 2019 年 10 月 24 日
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

採用された回答

per isakson
per isakson 2019 年 10 月 24 日
Try
logical_matrix = false( 1, 4 );
logical_matrix( b ) = true;
  3 件のコメント
Walter Roberson
Walter Roberson 2019 年 10 月 24 日
DM(i,b) = true;
Khairul Nur
Khairul Nur 2019 年 10 月 24 日
great! its work..thank you very much :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by