hist(rand(10000,1),30) doc hist hist(randn(10000,1),30) doc randi randi(7,20) ans = Columns 1 through 8 6 6 2 7 7 2 1 1 7 6 5 5 6 2 1 3 3 2 5 3 5 5 2 7 4 5 7 2 5 4 5 6 6 6 5 3 4 4 1 6 3 6 5 5 2 7 5 1 7 3 3 4 5 6 3 2 3 6 3 6 3 2 3 5 1 1 4 3 4 7 7 1 2 1 6 1 5 1 1 2 3 6 3 6 7 1 2 5 1 4 7 3 1 2 3 2 6 7 6 2 7 3 5 5 7 2 6 5 7 3 6 1 1 6 7 5 4 6 1 4 2 1 3 7 6 7 6 1 1 5 1 1 3 1 3 4 5 1 2 6 4 3 3 2 4 2 1 7 6 7 1 2 1 2 5 2 3 2 3 3 Columns 9 through 16 4 3 7 4 6 3 2 5 3 7 1 3 3 5 2 1 6 5 5 6 2 6 1 1 3 1 6 5 6 5 2 3 1 6 5 7 5 4 1 4 3 5 3 6 7 7 5 2 3 1 7 5 6 3 1 3 3 2 4 6 7 1 4 7 1 7 5 1 2 1 6 3 6 2 1 1 6 6 1 4 1 1 6 4 3 7 5 2 3 4 4 3 5 6 4 3 3 1 7 5 4 2 3 6 5 5 6 2 4 5 5 7 2 4 2 2 7 1 7 4 6 6 1 5 3 7 1 7 6 5 1 5 1 6 2 6 3 1 2 7 6 2 7 1 2 5 2 7 3 3 1 1 5 1 2 6 4 7 1 6 Columns 17 through 20 4 6 6 2 2 4 3 4 5 5 6 7 5 5 7 7 7 3 4 7 3 6 7 5 3 2 4 3 3 1 2 4 1 4 2 1 2 4 6 3 7 2 7 6 2 2 7 5 4 1 3 4 1 4 7 7 6 4 4 7 7 1 5 4 3 2 4 4 2 3 3 6 7 1 5 1 6 5 5 6 edit testwalk.m testwalk A {Undefined function or variable 'A'. } which testwalk \\nask.man.ac.uk\home$\MATLAB\testwalk.m pwd ans = \\nask.man.ac.uk\home$\MATLAB testwalk sum(A,2) ans = 1.0000 1.0000 1.0000 1.0000 1.0000 testwalk {Subscript indices must either be real positive integers or logicals. Error in testwalk (line 10) ws=cumsum(A(i,:)); } testwalk {Error using + Matrix dimensions must agree. Error in testwalk (line 12) y=y+u; } testwalk 11 u=histc(r,[0,ws]); if system_dependent('IsDebugMode')==1, dbstep; end testwalk testwalk x x = 100 100 100 100 100 x x = 100 100 100 100 100 testwalk x x = 132 131 77 90 70 exit