What does this code give o/p as?

9 ビュー (過去 30 日間)
Shruthi S
Shruthi S 2021 年 5 月 14 日
コメント済み: Shruthi S 2021 年 5 月 15 日
keyg=zeros(8,8);
key=[0 0 1 0 ;0 0 1 1 ;0 1 0 1; 0 1 1 1; 1 0 0 0; 1 0 1 0; 1 1 0 1; 1 0 1 1];
key1=[0 0 1 0 0 0 1 0 ;0 0 1 1 0 0 1 1 ;0 1 0 1 0 1 0 1; 0 1 1 1 0 1 1 1];
keyg(1:8,5:8)=key;
keyg(5:8,1:8)=key1;
orig_key=keyg;
  2 件のコメント
Geoff Hayes
Geoff Hayes 2021 年 5 月 14 日
Shruthi - you may need to provide some context. What are you hoping that this code will do?
Shruthi S
Shruthi S 2021 年 5 月 15 日
I was just trying random key generation

サインインしてコメントする。

採用された回答

DGM
DGM 2021 年 5 月 14 日
編集済み: DGM 2021 年 5 月 14 日
If you're asking what the output is (maybe you're away from a computer with Matlab at the moment)
keyg=zeros(8,8);
key=[0 0 1 0 ;0 0 1 1 ;0 1 0 1; 0 1 1 1; 1 0 0 0; 1 0 1 0; 1 1 0 1; 1 0 1 1];
key1=[0 0 1 0 0 0 1 0 ;0 0 1 1 0 0 1 1 ;0 1 0 1 0 1 0 1; 0 1 1 1 0 1 1 1];
keyg(1:8,5:8)=key;
keyg(5:8,1:8)=key1;
orig_key=keyg
orig_key = 8×8
0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1
I ran this using the tools in the editor used to make this post. I didn' have to even use Matlab. There is also a web-accessible version of Matlab available.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by