Finding the number of integers in a vector

조회 수: 3 (최근 30일)
Alex
Alex 2014년 12월 1일
댓글: Alex 2014년 12월 1일
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.

채택된 답변

Sean de Wolski
Sean de Wolski 2014년 12월 1일
편집: Sean de Wolski 2014년 12월 1일
nnz(v==round(v) & v>0)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Undirected Graphs에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by