-->M(2,2,2)=3 M = (:,:,1) ! 0. 0. ! ! 0. 0. ! (:,:,2) ! 0. 0. ! ! 0. 3. ! -->M(:,:,1)=rand(2,2) M = (:,:,1) ! 0.9329616 0.312642 ! ! 0.2146008 0.3616361 ! (:,:,2) ! 0. 0. ! ! 0. 3. ! -->M(2,2,:) ans = (:,:,1) 0.3616361 (:,:,2) 3. -->size(M) ans = ! 2. 2. 2. ! -->size(M,3) ans = 2.
They can be created from a vector of data and a vector of dimension
-->hypermat([2 3,2],1:12) ans = (:,:,1) ! 1. 3. 5. ! ! 2. 4. 6. ! (:,:,2) ! 7. 9. 11. ! ! 8. 10. 12. !
N-dimensionnal matrices are coded as mlists with 2 fields :
-->M=hypermat([2 3,2],1:12); -->M.dims ans = ! 2. 3. 2. ! -->M.entries ans = ! 1. ! ! 2. ! ! 3. ! ! 4. ! ! 5. ! ! 6. ! ! 7. ! ! 8. ! ! 9. ! ! 10. ! ! 11. ! ! 12. !