convert an array into its counting sequence..
5 ビュー (過去 30 日間)
回答 (2 件)
Jos (10584) 2019 年 8 月 2 日
This is called run-length encoding, for which there are very efficient functions available on the File Exchange.
I point you to my own function RUNINDEX which can also return this:
[~, RLE] = runindex(x)
y = reshape(RLE(:,[3 1]).', 1, ) % your format