## Hello everyone, I am stuck in a question. Can anyone there help me out? The question is as follows-

### SUDIPTA MUKHERJEE (view profile)

on 15 Jun 2018
Latest activity Commented on by SUDIPTA MUKHERJEE

on 23 Jun 2018

### KSSV (view profile)

I have a 3D matrix in which each 2D submatrix is of size 7×4.I have to randomly select any 4 out of these 7 rows(for various 3D indexes) except 1 row which will be decided by user input.That means, I can't select that particular row while selecting 4 rows. Thanks in advance.

### KSSV (view profile)

on 15 Jun 2018

A = rand(7,4) ;
NS = 2 ; %Don't select his row
idx = randperm(7,5) ; % random indices of row
idx = setdiff(idx,NS) ; % remove NS if present
S = idx(1:4) ; % select these rows
iwant = A(S,:)

Show 1 older comment
SUDIPTA MUKHERJEE

### SUDIPTA MUKHERJEE (view profile)

on 20 Jun 2018
Bro, now I am stuck in one more situation of the same problem. Can you help me out. Now, I have to randomly select 4 rows for all the 7 iterations(i.e for each & every 2D row). The set of rows which are to be selected for each iteration(of different 2D indexes) must be unique.How do I do this? Thanks in advance.
Walter Roberson

### Walter Roberson (view profile)

on 22 Jun 2018
How many iterations? If you have enough iterations then you would have to repeat.
SUDIPTA MUKHERJEE

### SUDIPTA MUKHERJEE (view profile)

on 23 Jun 2018
There will be 7 iterations for each 3D index.