New =[] generates an empty matrix of variable length. New =[new X] can be used to add elements or vectors, where X is the element or vector to be added to the matrix.

>> new = []; >> a = 1; b = 2; >> new = [new a] new = 1 >> new = [new b] new = 1 2 >> >> c = [1;2;3;4]; d = [5;6;7;8]; >> new = [new c] new = 1 2 3 4 >> new = [new d] new = 1 5 2 6 3 7 4 8Copy the code

Note that the dimensions of the vectors continuously added to the same empty matrix must be the same