randi 0 to 3 (2bits)

12 visualizaciones (últimos 30 días)
Nouha Derradji
Nouha Derradji el 12 de Abr. de 2020
Comentada: Nouha Derradji el 12 de Abr. de 2020
How can I define a random sequence of 16384 whole numbers between 0 and 3 and each integer represents two bits?

Respuesta aceptada

dpb
dpb el 12 de Abr. de 2020
v=randi([0 3],16384,1,'int8'); % save as int8; ML doesn' have arbitrary length integers.
You can visualize what have with
histogram(v)
dec2bin(v(1:10),2)
  1 comentario
Nouha Derradji
Nouha Derradji el 12 de Abr. de 2020
It's work thakx :DD

Iniciar sesión para comentar.

Más respuestas (1)

Matt J
Matt J el 12 de Abr. de 2020
randi([0,3],16384,1)

Community Treasure Hunt

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

Start Hunting!

Translated by