Filter löschen
Filter löschen

summation of each row in a 3D matrix

2 Ansichten (letzte 30 Tage)
kurdistan mohsin
kurdistan mohsin am 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

Antworten (1)

Image Analyst
Image Analyst am 8 Mai 2022
Bearbeitet: Image Analyst am 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.

Kategorien

Mehr zu MATLAB 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!

Translated by