How to duplicate a 2000 x 200 matrix n times
Show older comments
Dear
I have a matrix of size 2000 x 200 double. I am looking forward to duplicate this matrix 60 times as it is.
So if the matrix A is like
A=[1 2 3;4 5 6] and if I repeat it 2 times it must be like A=[1 2 3; 4 5 6; 1 2 3; 4 5 6; 1 2 3 ; 4 5 6]
I have tried to do this like
repmat(A,60,200);.
But it is producing the following error:
Error using repmat
Requested 6705122x31684 (1582.8GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Would you please show me the suitable way to duplicate the matrix?
Thanks,
Accepted Answer
More Answers (1)
You mean:
repmat(A, 61, 1)
In your example, you have "repeated" the input [2 x 3] matrix to the output [3 x 3] and call thims "2 times", so I assume you want 61 copies of the origibnal matrix.
Your code repmat(A,60,200) would repeat A "59" times horizontally and "199" times vertically.
By the way, you want to create a [2000 * 61 x 200] matrix. If this has the type double, it requires 192 MB.
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!