Placing a constant through a column

2 vues (au cours des 30 derniers jours)
DARLINGTON ETAJE
DARLINGTON ETAJE le 28 Août 2019
Commenté : DARLINGTON ETAJE le 28 Août 2019
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.

Réponse acceptée

madhan ravi
madhan ravi le 28 Août 2019
repmat(BB,3,1)
  3 commentaires
madhan ravi
madhan ravi le 28 Août 2019
Modifié(e) : madhan ravi le 28 Août 2019
Use:
repelem(BB,3)
DARLINGTON ETAJE
DARLINGTON ETAJE le 28 Août 2019
Thank you...you're such a blessing

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by