I'm having a major problem that doesn't make any sense to me. Basically, I have an array x2 = [4;5;6], a scalar N = 3, an array of zeros size 7 * 7 called b, and an array m = [1 2 3 4 5 6 7]. I want to iterate through m and assign the columns of b like my code shows. What I am doing wrong, and how can I achieve this?
Keep in mind that when I tell matlab to assign columns individually by using a number 1 through 7 in place of "m" the column is assigned correctly. It is just when I try to assign all of them with one command that it tells me, "??? Subscripted assignment dimension mismatch"
N = 3;
x2 = [4;5;6];
b = zeros(3*N-2,3*N-2);
m = 1:(3*N-2);
b(:,m) = [zeros(m-1,1);x2;zeros(2*N-1-m,1)]
??? Subscripted assignment dimension mismatch