To concatenate arrays in MATLAB, you can use the square brackets [] operator. Here are a couple of different approaches:
Concatenating arrays horizontally: To concatenate arrays horizontally, you can place the arrays next to each other inside the square brackets. The resulting array will have the same number of rows as the original arrays, but the columns will be appended.
main.m107 chars10 lines
Output:
main.m22 chars2 lines
Concatenating arrays vertically: To concatenate arrays vertically, you can separate the arrays with a semicolon (;) inside the square brackets. The resulting array will have the same number of columns as the original arrays, but the rows will be appended.
main.m107 chars10 lines
Output:
main.m20 chars3 lines
Make sure the arrays you want to concatenate have compatible dimensions, otherwise MATLAB will throw an error.
gistlibby LogSnag