MATLAB: Generate matrices of the form [a b c d]

codecombinationspermutationspseudo codevectorization

If I have matrices of the form [a b c d]
where
2<=a<=4
1<=b<=2
3<=c<=4
2<=d<=4
Could someone help me with the code/pseudo code to generate all possible matrices?

Best Answer

Of course you could just do a trivial, brute force way of 4 nested "for" loops, which I'm sure you can do. (If not, let us know.) But I'm thinking that you're wanting some more clever method, right? Or not right, and the trivial way is fine?
Oh well, here's the trivial way, just to save time:
for a = 2:4
for b = 1:2
for c = 3:4
for d = 2:4
out = [a,b,c,d]
end
end
end
end