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)
  1 件のコメント
Alex
Alex 2014 年 12 月 1 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeUndirected Graphs についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by