Borrar filtros
Borrar filtros

What does this code give o/p as?

1 visualización (últimos 30 días)
Shruthi S
Shruthi S el 14 de Mayo de 2021
Comentada: Shruthi S el 15 de Mayo de 2021
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 comentarios
Geoff Hayes
Geoff Hayes el 14 de Mayo de 2021
Shruthi - you may need to provide some context. What are you hoping that this code will do?
Shruthi S
Shruthi S el 15 de Mayo de 2021
I was just trying random key generation

Iniciar sesión para comentar.

Respuesta aceptada

DGM
DGM el 14 de Mayo de 2021
Editada: DGM el 14 de Mayo de 2021
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.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by