Symbolic 4D array
显示 更早的评论
I have a symbolic 4D array V(i,j,k,l). I want to sum over the l component to reduce it to 3D. I tried x(i,j,k)=sum(V(i,j,k,:)) but it is not working. Any advice
回答(1 个)
James Tursa
2016-8-2
Not sure why sum(V,4) doesn't work, but reducing it to 2D with some reshapes seems to work:
z = size(V);
x = reshape(sum(reshape(V,[],z(end)),2),z(1:end-1));
2 个评论
ahmed sengab
2016-8-3
Sulaymon Eshkabilov
2020-9-8
sum(V, 4) works ok! but reshape() thing gives a size related error.
类别
在 帮助中心 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!