counter odd numbers in 'randi'?

1 visualización (últimos 30 días)
tomer kapuri
tomer kapuri el 2 de Dic. de 2018
Comentada: tomer kapuri el 3 de Dic. de 2018
counter of odd numbers in 'randi'?
this is program:
a=randi([0 27],1,50);
b=zeros(1,numel(a)*3+numel(a));
b(4:4:end)=a(:)
what is need write after that?

Respuesta aceptada

Image Analyst
Image Analyst el 2 de Dic. de 2018
Try this:
a=randi([0 27],1,50)
numberOfOddNumbers = sum(rem(a, 2))

Más respuestas (1)

madhan ravi
madhan ravi el 2 de Dic. de 2018
Editada: madhan ravi el 2 de Dic. de 2018
a=randi([0 27],1,50);
b=zeros(1,numel(a)*3+numel(a));
b(4:4:end)=a;
b(rem(b,2)~=0 & ~isprime(b))
  2 comentarios
tomer kapuri
tomer kapuri el 2 de Dic. de 2018
is not working - its not counter :(
madhan ravi
madhan ravi el 2 de Dic. de 2018
give an example to understand

Iniciar sesión para comentar.

Categorías

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