Finding the number of integers in a vector

3 vues (au cours des 30 derniers jours)
Alex
Alex le 1 Déc 2014
Commenté : Alex le 1 Déc 2014
Hello , im having a little trouble with a script to find a number of positive integers in a vector inputed by user without using loop comands. (have to do it for the uni) i know it should be simple but i cant figure it out. any help?
for example if input vector is v=[1 5 6 1.4 -4 0.5] then the number n should be 3.

Réponse acceptée

Sean de Wolski
Sean de Wolski le 1 Déc 2014
Modifié(e) : Sean de Wolski le 1 Déc 2014
nnz(v==round(v) & v>0)

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by