how to reorder the data
3 views (last 30 days)
Show older comments
i have some values
G1 G2 G3 G4 G5
1 2 4 5 9 0 2 3 6 7
2 3 6 7 1 2 4 5 8 9
I want to reorder the group randomly ,can u tell how to do please
0 Comments
Accepted Answer
Andrei Bobrov
on 31 Oct 2011
G = [1 2 4 5 9 0 2 3 6 7
2 3 6 7 1 2 4 5 8 9]
G1 = mat2cell(G,2,2*ones(size(G,2)/2,1))
Gout = cell2mat(G1(randperm(numel(G1))))
or
G1 = reshape(G,4,[])
G2 = G1(:,randperm(size(G1,2)))
Gout = reshape(G2,2,[])
4 Comments
More Answers (0)
See Also
Categories
Find more on Engines & Motors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!