フィルターのクリア

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 Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by