how to produce a logical matrix using index matrix

2 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by