Borrar filtros
Borrar filtros

Without mod function and any loops(i.e for or while)

2 visualizaciones (últimos 30 días)
Vikas Rahar
Vikas Rahar el 3 de Nov. de 2019
Comentada: Vikas Rahar el 4 de Nov. de 2019
I am wondering, is it poosible to find the even or odd numbers in a vector whithout using mod(or any inbulit functions) function or loops?
  2 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 4 de Nov. de 2019
Without any function, or we can use other functions apart from mod or rem?
Vikas Rahar
Vikas Rahar el 4 de Nov. de 2019
I am hoping to not use any function at all.

Iniciar sesión para comentar.

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 4 de Nov. de 2019
Editada: KALYAN ACHARJYA el 4 de Nov. de 2019
Here I have used one bitget function or without any function???
a=[3 4 5 6 8]; % Just an example
data_odd=a.*bitget(a,1);
data_odd(data_odd==0)=[]
data_even=a.*~bitget(a,1);
data_even(data_even==0)=[]

Más respuestas (0)

Categorías

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