Problem with isinteger() - how to determine whether a constant is integer?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Amit Kumar
le 21 Fév 2013
Commenté : Walter Roberson
le 10 Août 2017
Hi, I have problem with isinteger() function. I wrote following function:
function [x] = f1(n)
b=ininteger(n);
end
This is a partial code. I want to accept integer n to function f1. Whenever user inputs integers, such as 3 or 4, b = 0 as Matlab treats constants as double. I tried converting n to int8(), but then floating value also gets converted to integer. How to test whether input constant is an integer or not? Thanks.
0 commentaires
Réponse acceptée
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!