Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a matrix called drt which is 1x200 which contains only integer values and I want to shuffle these values inside the matrix. please how do I go about it ,I tried randperm and randsample but they are not working.

Answers in C or Matlab is welcomed.Thanks

What I have tried:

%create an array and fill it with numbers from 1 to fsum
fsum=200;
randm=zeros(1,fsum);
for rn=1:+1:fsum
randm(1,rn)=rn;
end
% to shuffle the array
randm=randm(randperm(length(randm)));

OR

randm=randsample(randm,fsum);
Posted
Updated 3-Jan-17 17:27pm
Comments
PIEBALDconsult 3-Jan-17 17:56pm    
Why?

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900