HOW TO SORT INTO GROUPS
显示 更早的评论
I have values
col1 col2
1 9
2 4
3 5
4 6
5 1
6 9
7 0
8 3
9 1
0 2
I WANT TO DIVIDE THIS INTO 5 GROUPS MY OUTPUT IS
1 9 3 5 5 1 7 0 9 1
2 4 4 6 6 9 8 3 0 2
PLEASE CAN ANYONE HELP
2 个评论
Fangjun Jiang
2011-9-17
Please format your code and explain what is the grouping.
the cyclist
2011-9-17
Pat, please try to imagine yourself as a reader who knows nothing about your problem. It is impossible to understand what you want to do. Please provide more detail.
采纳的回答
更多回答(1 个)
Fangjun Jiang
2011-9-17
a=[1 9
2 4
3 5
4 6
5 1
6 9
7 0
8 3
9 1
0 2 ];
b=mat2cell(a,repmat(2,size(a,1)/2,1),size(a,2));
c=cell2mat(b');
2 个评论
Jan
2011-9-18
@Fangjun: Pat asks for 5 groups, but he showed 6 groups. Your code replies a {2 x 10} cell.
Fangjun Jiang
2011-9-18
I see! Then b or b' should be the outcome.
The OP doesn't seem to be responsive at all based on his history.
类别
在 帮助中心 和 File Exchange 中查找有关 Calendar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!