Info
此问题已关闭。 请重新打开它进行编辑或回答。
how can i split a column and create a new one??
1 次查看(过去 30 天)
显示 更早的评论
suppose A is the column A= 1 2 3 4 4 4 4 3 3 3 2 2 1 and i want m= 1 1; n= 2 2 2; o= 3 3 3 3; p= 4 4 4 4 ;
can anyone tell me this???
0 个评论
回答(1 个)
Azzi Abdelmalek
2015-3-1
A=[ 1 2 3 4 4 4 4 3 3 3 2 2 1]
[B,ii,jj]=unique(A)
out=accumarray(jj,1:numel(jj),[],@(x) {A(x)})
celldisp(out)
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!