I am looking for a code to identify if the entered number is odd or even. For example: "ABC 123", I would be really grateful if someone shares the code.
Mostra commenti meno recenti
I tried using mod function but it doesn't work as my input contains Alphabet and numbers both.
Risposta accettata
Più risposte (1)
sscanf is probably the most efficient way to convert that char vector into a numeric:
>> sscanf('ABC 123','%*s %d')
ans = 123
Categorie
Scopri di più su Data Type Conversion in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!