how can i calculate how many number of times that 1 occurs.
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
vetri veeran
il 13 Dic 2014
Modificato: Azzi Abdelmalek
il 13 Dic 2014
I have an array like this
x =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
how can i calculate how many number of times that 1 occurs.
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 13 Dic 2014
Modificato: Azzi Abdelmalek
il 13 Dic 2014
x=repmat(1:4,4,1) % Example
out=sum(x(:)==1)
%or
out=nnz(x==1)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Types in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!