필터 지우기
필터 지우기

How can I write a matrix 6x1 that the element (2,1) and (6,1) equal to 1 and others are zero?

조회 수: 2 (최근 30일)
like this : 0 1 0 0 0 1

채택된 답변

Star Strider
Star Strider 2014년 10월 8일
If the vector is ‘A’, this works:
A([2 6]) = 1;
produces:
A =
0 1 0 0 0 1

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by