Placing a constant through a column

5 ビュー (過去 30 日間)
DARLINGTON ETAJE
DARLINGTON ETAJE 2019 年 8 月 28 日
コメント済み: DARLINGTON ETAJE 2019 年 8 月 28 日
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.

採用された回答

madhan ravi
madhan ravi 2019 年 8 月 28 日
repmat(BB,3,1)
  3 件のコメント
madhan ravi
madhan ravi 2019 年 8 月 28 日
編集済み: madhan ravi 2019 年 8 月 28 日
Use:
repelem(BB,3)
DARLINGTON ETAJE
DARLINGTON ETAJE 2019 年 8 月 28 日
Thank you...you're such a blessing

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by