XWe have been assigned a task in which we want to concatenate several column vectors into a large matrix inside a for-loop. We wrote a little example program to try to find out what it was that didn't work, and we got pretty stuck.
In this example program, we want our matrix X (that's originally an empty matrix) to be a 5 X 5 matrix with only ones in it. We did this using a for loop, and we returned the value X ultimately, but it was still an empty matrix/vector. Below is our syntax;
X = [];
for i=1:5,
X = horzcat(X, [1 1 1 1 1]');
end
X