How to do random arrangement of data like this using a FOR Loop?
    5 views (last 30 days)
  
       Show older comments
    
Please consider my sample code:
 N=256; % some constant
 data=randsrc(1,N,[1:.01:5]); % data points
 b=[1,2,4,8,16] % no. of blocks where a b represents no. of rows in output matrix
How to divide my data(1x256)into blocks b=[1,2,4,8,16] in a Random Grouping of data indices like this using a FOR Loop:
For a single output matrix following are the conditions:
- Each row randomly picks up the data point excluding the data points picked up by other Row
 - and rest of the indices in a row have a zero.
 - order of data indices picked up does not matter
 
Output Matrix are as follows:
 out1= 1xN = same as data(1x256)(no division into blocks)
 out2= is a 2xN matrix
       row 1 picks up random 128 data points (in any order)
       row 2 picks rest of 128 data points (excluding data points of row 1)
       and places them at a different index (other than that of row 1)
       And rest of indices are zero in any row.
Similarly,
 out4=  is a 4xN matrix
        Each row uniquely picks random 64 data points
 out8=  is 8xN matrix
        and Each row picks 32 random data points 
 out16= is a 16xN matrix
        and Each row picks 16 random data points.
How to do this using a FOR Loop running for b=[1,2,4,8,16] ?
0 Comments
Answers (0)
See Also
Categories
				Find more on Matrix Operations in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!