MATLAB: Auto fill zero matrix without row-repetitions

for loopMATLABrandom

Please help. I'm new to matlab scripting and need a bit of help. I have a series of numbers: test = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5] which I wants to randomely fill into a 5×3 matrix without having the same number in the same row. How can I do this??? Potentially I could randomize the test vector and fill it into the 5×3 matrix but I dont know how to do this without getting the same number in the same row. PLEASE help…

Best Answer

Thanks a lot for your suggestions. However, I made a minor mistake. I want the final matrix to be a 3x5 instead of a 5x3 matrix. Sorry guys, but I still need a bit of help to establish the correct code.