Vector operations

1 次查看(过去 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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by