フィルターのクリア

Vector operations

4 ビュー (過去 30 日間)
Steven
Steven 2011 年 11 月 7 日
I'm looking for something that can repeat a vector without. For exemple, here a is repeated 4 times :
a = [1,2,5];
b = cellfun(a, 4);
b = [1 1 1 1 2 2 2 2 5 5 5 5];
thx

採用された回答

Wayne King
Wayne King 2011 年 11 月 7 日
One way:
a = [1,2,5];
b = reshape(repmat(a,4,1),12,1);
  1 件のコメント
Andrei Bobrov
Andrei Bobrov 2011 年 11 月 7 日
b = reshape(ones(4,1)*a,1,[]);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by