MATLAB: I have a 6031*6 matrix an to extract 100 random data compounds to build a 3*100 matrix.What should I do

matrix

randi(100,3,A)

Best Answer

Here is what you directed in your comment:
A = rand(6031, 6); % Some random data
% "extract the second and third columns of A to build a new matrix B:
B = A(:, 2:3);
% "extract 3 random rows from B to build a new matrix C"
rowsToExtract = randperm(size(B, 1), 3)
C = B(rowsToExtract, :)
Note that this does not give 100 columns since you extracted only columns 2 and 3, not 100 columns.