MATLAB: How to form a matrix as our requirements?????

matrix arraymatrix manipulation

Hello
I wanna create a matrix as size is 50rows 6 columns.The sum of each row is 100. the value limits is 0 to 100 its may be float value .For example of one row is
[20 40 10 5 5 20]

Best Answer

x = rand(50, 6);
x = x./sum(x,2)*100;
Result
>> sum(x,2)
ans =
100.0000
100.0000
100.0000
..
..
..
100.0000
100.0000