How to repeat rows of a matrix sequentially?
3 次查看(过去 30 天)
显示 更早的评论
I have a column with 24 rows as attached in the file 'DATA.xlsx'. I want each row to repeat 20 times one after the other i.e.first and second element in the given column is 23, 45 and so on. The new column should contain 20 rows of 23 then 20 rows of 45 and so on keep repeating. How can this be done? Thanks and regards, Parth
0 个评论
回答(2 个)
Roger Stafford
2016-5-3
Let your present 24 x 1 column vector be called x.
x2 = reshape(repmat(x.’,20,1),[],1);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!