Without mod function and any loops(i.e for or while)
17 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Vikas Rahar
il 3 Nov 2019
Commentato: Vikas Rahar
il 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 Commenti
KALYAN ACHARJYA
il 4 Nov 2019
Without any function, or we can use other functions apart from mod or rem?
Risposta accettata
KALYAN ACHARJYA
il 4 Nov 2019
Modificato: KALYAN ACHARJYA
il 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)=[]
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dimensionality Reduction and Feature Extraction in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!