how to produce a logical matrix using index matrix

조회 수: 2 (최근 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 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