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
0 件のコメント
採用された回答
Star Strider
2014 年 10 月 8 日
If the vector is ‘A’, this works:
A([2 6]) = 1;
produces:
A =
0 1 0 0 0 1
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!