Repeat matrix element of a given matrix
古いコメントを表示
my matrix is x=[2 5 3 6 1]
I want it to make it as y=[2 2 2 2 5 5 5 5 3 3 3 3 6 6 6 6 1 1 1 1]
which function does it?
1 件のコメント
Jan
2015 年 3 月 11 日
This topic is discussed such frequently, that I miss it in the FAQ.
採用された回答
その他の回答 (3 件)
Another quick one-liner:
reshape(ones(4,1)*x,1,[])
Andrei Bobrov
2015 年 3 月 11 日
x = [2 5 3 6 1];
y = x(ceil((1:4*numel(x))/4));
3 件のコメント
Nikhil Chourasia
2015 年 3 月 11 日
Nikhil Chourasia
2015 年 3 月 13 日
Andrei Bobrov
2015 年 3 月 13 日
x = unique(y);
カテゴリ
ヘルプ センター および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!