Effacer les filtres
Effacer les filtres

summation of each row in a 3D matrix

2 vues (au cours des 30 derniers jours)
kurdistan mohsin
kurdistan mohsin le 8 Mai 2022
hello all ,
I have the bellow 3D matrix and i want to find the summation value of each row separately , anyone can help?
c(n,i,1) n=10; i=10
0 1 0 0 1 0 0 1 0 1
1 0 1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 0 0 0 1
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 1 0 0

Réponses (1)

Image Analyst
Image Analyst le 8 Mai 2022
Modifié(e) : Image Analyst le 8 Mai 2022
Why a for loop? Why not simply use sum():
m = randi(9, 2,3,4)
sumMatrix = squeeze(sum(m, 1))'
If it's because it's your homework, then yes, we can help but not provide the complete solution for you to turn in our solution as your own, because your professor wants your work, not ours.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by