how to sum all elements of one vector?
75 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi every one ; how to sum elements of one vector ; Ex: if C =[ 2;3;4;5] .. D = the summation of all elements in C , D = 14. So how can i get D??... by the way how can i divide each element from C over D .. so C will be = [0.1428 ;0.2142; 0.2857; 0.3571] . thanks
0 comentarios
Respuestas (1)
KL
el 10 de Oct. de 2017
Editada: KL
el 10 de Oct. de 2017
D = sum(C);
div = C./D; %./ meaning element-wise division
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!