I have a matrix like:
A=
4 7 8 9
3 3 5 7
6 4 8 6
and wants to random shuffle columns and do it something like:
A=
8 4 9 7
5 3 7 3
8 6 6 4
does anyone have any idea?
I have a matrix like:
A=
4 7 8 9
3 3 5 7
6 4 8 6
and wants to random shuffle columns and do it something like:
A=
8 4 9 7
5 3 7 3
8 6 6 4
does anyone have any idea?
You can shuffle columns using indexing:
A(:,[3 1 4 2])
If you want to do it randomly, you can create a random permutation:
A(:,randperm(size(A,2)));