how to duplicate the values in one matrix create another matrix of specific dimension

16 views (last 30 days)
Elysi Cochin on 1 Nov 2019
Edited: Elysi Cochin on 21 Nov 2019
i have a cell array of dimension 1x60, each matrix in cell array is of dimension 23x23 of double datatype
i converted this cell array to matrix using cell2mat and got a matrix A, of dimension 23x1380
how can i duplicate the values in the matrix A, to create another matrix B, of dimension 368x19872 double datatype using any suitable pattern
The values can be duplicated in any suitable pattern to achieve a matrix of dimension 368x19872 (either from [1 2 3] to [1 1 1 2 2 2 3 3 3] or to [1 2 3 1 2 3 1 2 3])
is it possible to get a matrix of dimension 368x19872, from the cell array 1x60 directly without converting to matrix of dimension 23x1380 ?
any suitable replicating method can be choosen. only the output dimension with the same data values is needed

ME on 1 Nov 2019
Assuming you want the rest of the larger matrix to be zeros, then you could use:
s=size(A);
B(1:s(1),1:s(2)) = A;
This will set A as the first 23x1380 elements of B. Is that what you wanted?
Guillaume on 1 Nov 2019
@Elysi, You've asked enough questions here over the years that by now you should know how to write a question properly, i.e. give as many details as possible about what you want. How should the values be duplicated (do we go from [1 2 3] to [1 1 1 2 2 2 3 3 3] or to [1 2 3 1 2 3 1 2 3])? Why is 19872 not a multiple of 1380 and therefore how do you duplicate something by a fraction?
If you don't give details, people have to guess at what you want and may get it wrong, wasting your and their time.

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!

Translated by