how to compute number of element in matrix ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Firas Al-Kharabsheh
el 28 de Abr. de 2016
Respondida: Azzi Abdelmalek
el 28 de Abr. de 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 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 28 de Abr. de 2016
A = [ 1 3 2 0
2 2 1 0
1 2 1 1 ]
a=sum(A,2)
b=sum(A~=0,2)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!