subplot( 2 , 3 , 4 ) % index id=4 refers to first subplot in second line, see below
How to get subplot indexes for two loops over figure columns and rows?
Example 2 x 3 subplots, by using sub2ind
Note, while the subplot index goes horizontally (line by line), sub2ind refers to matrix-index which goes vertically (column by column). Thus, we need to switch column and row indexes.