フィルターのクリア

want to generate this matrix

3 ビュー (過去 30 日間)
VASUNDHARA V
VASUNDHARA V 2022 年 2 月 12 日
編集済み: DGM 2022 年 2 月 12 日
Hello
I want to generate this below matrix in matlab..i am trying ones ,zeros and eye command but not getting this one
[1100010
1000010
1110010
0001101
0000010]

採用された回答

DGM
DGM 2022 年 2 月 12 日
編集済み: DGM 2022 年 2 月 12 日
What's wrong with
A = [1 1 0 0 0 1 0;
1 0 0 0 0 1 0;
1 1 1 0 0 1 0;
0 0 0 1 1 0 1;
0 0 0 0 0 1 0];
If the location of the elements of the array is independent of any other variable, and if there is no clear pattern to their distribution, then it might as well be a literal constant.
I suppose you could also do:
A = zeros(5,7)
A([1 2 3 6 8 13 19 24 26 27 28 30 34]) = 1;
but I don't know that it saves much.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by