Question

I have a matrix of 2 values let say matrix=[1,2]; Now I want to insert 3,4 into the matrix, below 1,2. in the end I want a matrix with 2 cols and with n values. Can you help me please? thanks!

Was it helpful?

Solution

vertcat will concatenate arrays/matrices with the same number of columns on top of each other.

Alternatively, you can just do it manually with something like

a = [1, 2];
b = [3, 4];
a = [a; b];

Here, the semi-colon denotes a new row.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top