How to make columns the same size

7 visualizaciones (últimos 30 días)
Matheus Brito
Matheus Brito el 21 de Feb. de 2020
Respondida: Jos (10584) el 21 de Feb. de 2020
My data has two columns (A and B). Column A has a number of rows. Column B has fewer rows than A. How can I make column B have the same number of rows as A ? also, These rows must be filled with the average of the row data in column A.

Respuesta aceptada

Jos (10584)
Jos (10584) el 21 de Feb. de 2020
A solution:
A = [1 3 ; 2 4 ; 5 7]
B = [10 11 12 ; 13 14 15]
newB = repmat(mean(A,2), 1, size(B,2))
newB(1:size(B,1),:) = B

Más respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by