Reduce one dimension of a array by using sum
Ältere Kommentare anzeigen
Hello,
Can anyone show me how I can reduce one dimension of the following array without using for loops. Thanks!
A=rand(100,100,100);
for ith = 1:100
for jth = 1:100
B(ith,jth) = sum(A(ith,:,jth))
end
end
Akzeptierte Antwort
Weitere Antworten (1)
Azzi Abdelmalek
am 19 Okt. 2012
A=rand(100,100,100);
out=sum(A,3)
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!