How do I make these matrix sizes the same?

58 Views Asked by At

I have 1x252 matrix and a 13x252 matrix. I need to make them match so I can find the correlation coefficients using corrcoef. Not entirely sure how to use the function, and I haven't done a lot of matlab in a while.

1

There are 1 best solutions below

0
On

Without more details about how your data is configured in the matrices, this is I came up with. The script uses the repmat() function to repeat/duplicate the rows of Matrix_1 in this example.

%Random data sets%
Matrix_1 = rand(1,252);
Matrix_2 = rand(13,252);

%Repeating the rows of x to match the number of rows in y%
Matrix_1 = repmat(Matrix_1,13,1);


Correlation_Coefficients = corrcoef(Matrix_1,Matrix_2);
Correlation_Coefficients

Using MATLAB version: R2019b