bar and barh functions:
For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown:
rm = randint(2,4,[1 50])
8 19 43 25
35 44 30 45
gives the plot as shown in the figure.
Note that the MATLAB groups altogether the values in the first row and then in the next row. It cycles through colors to differentiate the bars. The 'stack' option will stack instead of grouping the values; therefore the y value presented by the top of the bar is the addition of the values from that row as shown in fgure.