简体   繁体   中英

Matlab: Creating 3D array from a vector

I don't think I know tricks to use repmat in Matlab yet. I tried a number of combination and I am not able to achieve what I need.

I have a vector A of size 1 x 20. I just want to stack A to create 3 x 5 x 20 size matrix. Can you please help ?

A = 1:20;
reshape(repmat(A, [15, 1]), [3,5,20])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM