title: matlab more efficient random links creation
body: <p>I have this section to make some random links in groups. Can I make it more efficient? Any idea?</p>
  
  <p>Thanks.</p>
  
  <pre><code>n=[10 ;10 ;10];
  no_of_groups=size(n,1);
  for k=1:no_of_groups
      if k==1
          m{k,1}=randi(n(1), n(1),2);%random links between nodes of group1
          m1=rand(n(1),1)/2+0.5;%random weight to edges
          c{k,1} = cat(2,m{1},m1);
      else
          m{k,1}=randi([((k-1)*n(k-1)+1) (k*n(k))],n(k),2););%random links between nodes of group k
          m1=rand(n(k),1)/2+0.5;
          c{k,1} = cat(2,m{k,1},m1);
      end
  end
  c=cat(1,c{:});
  </code></pre>