フィルターのクリア

summation of each row in a 3D matrix

2 ビュー (過去 30 日間)
kurdistan mohsin
kurdistan mohsin 2022 年 5 月 8 日
編集済み: kurdistan mohsin 2022 年 5 月 8 日
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

回答 (1 件)

Image Analyst
Image Analyst 2022 年 5 月 8 日
編集済み: Image Analyst 2022 年 5 月 8 日
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.

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by