How can I assign two sets of values randomly among two other sets?
    4 次查看(过去 30 天)
  
       显示 更早的评论
    
I have two sets a and b, these sets of values to another two sets s1 and s2. I tried for randperm but i am getting errors. Thanks in advance.....
0 个评论
回答(2 个)
  KSSV
      
      
 2016-10-7
        
      编辑:KSSV
      
      
 2016-10-7
  
      Using randsample
% Create two sets 
a = rand(10,1) ;
b = rand(20,1) ; 
% Assign to s1, s2 randomly 
s1 = randsample(a,length(a)) ;
s2 = randsample(b,length(b)) ;
Using randperm
% Create two sets 
  a = rand(10,1) ;
  b = rand(20,1) ; 
  % Assign to s1, s2 randomly 
  s1 = a(randperm(length(a))) ;
  s2 =  b(randperm(length(b)))  ;
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 ROC - AUC 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

