[Scilab-users] row-sum of a hyper-matrix without loop
Samuel Gougeon
sgougeon at free.fr
Sun Nov 24 20:01:32 CET 2019
Le 24/11/2019 à 19:53, fujimoto2005 a écrit :
> Is it posible to get a 2-dimension matrix y(j,k) =Σ_i x(i,j,k) from 3
> dimension hyper- matrix x(i,j,k) without using k-loop?
> If there is such a way, please teach me.
--> h = grand(4,3,2,"uin",0,3)
h =
(:,:,1)
0. 0. 2.
2. 3. 3.
2. 1. 3.
1. 1. 1.
(:,:,2)
0. 3. 1.
2. 0. 1.
3. 1. 3.
0. 2. 3.
--> matrix(sum(h,1),-1,size(h,2))
ans =
5. 9. 6.
5. 5. 8.
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191124/0a38d6bf/attachment.htm>
More information about the users
mailing list