Borrar filtros
Borrar filtros

how to generate a random digital sequence formed of only two bits

1 visualización (últimos 30 días)
fo example how to generate 00 or 01 0r 10 or 11 randomly?

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 12 de En. de 2013
randi(2,2,1)'-1
  4 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 12 de En. de 2013
Editada: Azzi Abdelmalek el 12 de En. de 2013
randi(4,5,6) will generate a random matrix 5x6 with numbers from 1 to 4
In our case
randi(2,1,2) will generate array 1x2 with numbers from 1 to 2, to make it from 0 to 1
out=randi(2,1,2)-1
mary
mary el 12 de En. de 2013
aha ok thanx indeed for your explination.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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