Opposite of repmat() ? Collapse an array with repetitions
3 次查看(过去 30 天)
显示 更早的评论
Hello!
I have an array (3 by X by Y) that is like this that I would like to collapse:
6 2 1
6 2 1
6 2 1
(let's say 32 times more)...
7 9 8
7 9 8
7 9 8
(again 32 times more)
2 1 2
2 1 2
2 1 2
(and again, and more times)...
I would like to collapse it to
6 2 1
7 9 8
2 1 2
...
Any suggestions? I figure there is an easy way to do that (perhaps with reshape()?) but haven't figured it out.
Thanks.
Doug
0 个评论
采纳的回答
Star Strider
2015-3-13
I would use the unique function with the 'rows' option, although you may have to iterate over the third (‘page’) dimension in a for loop.
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!