Count the index of the array
Mostra commenti meno recenti
Hi, I have a array like below: [0 0 0 0 0 0 0 0 0 10 0 0 0 0 15 0 17]
I want count how many numbers >0 in the array (like in this case count is 3 (because 10,15,&17). Can some please help me how to count this in matlab. Thanks in advance
Risposta accettata
Più risposte (2)
Shoaibur Rahman
il 20 Dic 2014
A=[0 0 0 0 0 0 0 0 0 10 0 0 0 0 15 0 17];
sum(A>0)
Javaid Iqbal
il 3 Dic 2018
1 voto
n=numel(A);
1 Commento
madhan ravi
il 3 Dic 2018
no this would give you total number of elements in the array
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!