how can i write this statement labels=[1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;]; in compress form?
2 次查看(过去 30 天)
显示 更早的评论
how to write it in compact form avoiding repetition
0 个评论
采纳的回答
Andrei Bobrov
2014-6-25
labels = kron((1:3)',ones(24,1));
or
labels = reshape(ones(24,1)*(1:3),[],1);
更多回答(2 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!