how can i calculate how many number of times that 1 occurs.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
vetri veeran
am 13 Dez. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Dez. 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 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 13 Dez. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Dez. 2014
x=repmat(1:4,4,1) % Example
out=sum(x(:)==1)
%or
out=nnz(x==1)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!