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

17 vues (au cours des 30 derniers jours)
Vikas Rahar
Vikas Rahar le 3 Nov 2019
Commenté : Vikas Rahar le 4 Nov 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 commentaires
KALYAN ACHARJYA
KALYAN ACHARJYA le 4 Nov 2019
Without any function, or we can use other functions apart from mod or rem?
Vikas Rahar
Vikas Rahar le 4 Nov 2019
I am hoping to not use any function at all.

Connectez-vous pour commenter.

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 4 Nov 2019
Modifié(e) : KALYAN ACHARJYA le 4 Nov 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)=[]

Plus de réponses (0)

Catégories

En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by