how to compute number of element in matrix ?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Firas Al-Kharabsheh
am 28 Apr. 2016
Beantwortet: Azzi Abdelmalek
am 28 Apr. 2016
if i have this matrix
A = [ 1 3 2 0
2 2 1 0
1 2 1 1 ]
first i want to compute x which mean the sum of element in each row like this
x = [ 6
5
5 ]
second i want to compute y which mean the number of element non zero in each row like this
y = [ 3
3
4 ]
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 28 Apr. 2016
A = [ 1 3 2 0
2 2 1 0
1 2 1 1 ]
a=sum(A,2)
b=sum(A~=0,2)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and 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!