MATLAB: Making matrices with conditions

conditionsmatrices

hello,
1) How do I make a 6×5 matrice with even whole numbers between 20 and 100 (with 20 and 100 included)
2)How do I make a 6×5 matrice with different whole numbers between 20 and 100
thank you in advance

Best Answer

Are you trying to make a matrix with random elements? If yes, then try randi()
lb = 20;
ub = 100;
M_even = randi([lb ub]/2, 6, 5)*2;
M_whole = randi([lb ub], 6, 5);