Placing a constant through a column

Imagine this
A=(1:30)';
B=(31:60)';
C=(61:90)';
D=[A B C];
S = numel(B);
xx = reshape(B(1:S - mod(S, 3)), 3, []);
BB = sum(xx, 1).' / 3;
F=[A B C BB];
You will notice F is not possible because BB has just 10 variables (Dimensions of arrays being concatenated are not consistent.)
What I need to do is make each value in BB constant for 3 rows so that F can become possible.

 Respuesta aceptada

madhan ravi
madhan ravi el 28 de Ag. de 2019
repmat(BB,3,1)

3 comentarios

Nice try...almost there...this is how the BB should finally be
32
32
32
35
35
35
38
38
38
41
41
41
44
44
44
47
47
47
50
50
50
53
53
53
56
56
56
59
59
59
madhan ravi
madhan ravi el 28 de Ag. de 2019
Editada: madhan ravi el 28 de Ag. de 2019
Use:
repelem(BB,3)
DARLINGTON ETAJE
DARLINGTON ETAJE el 28 de Ag. de 2019
Thank you...you're such a blessing

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Ag. de 2019

Comentada:

el 28 de Ag. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by