Friday, November 23, 2012

Concatenation error

Any idea what is wrong here?

>> A = [-1./alpha.^2 -3./2./sig.^2, 1./alpha.^2-1./sig^2, -1./2./sig.^2;... 
1./alpha.^2-1./sig.^2, -2./alpha.^2-1./sig.^2, 1./alpha.^2-1./2./sig.^2;... 
-1./2./sig.^2, 1./alpha.^2-1./2./sig.^2, -1./alpha.^2-1./2./sig.^2];
??? Error using ==>>checkDimensions at 76
CAT arguments dimensions are not consistent.

Error in ==>>catMany at 39
[resz, ranges] = checkDimensions(sz,dim);

Error in ==> at 29
    y = catMany(dim, strs);

Error in ==> sym.vertcat at 26
    y = cat(1,args{:});

Turns out there is an innocuous looking white space on the first line before the -3. Next time be careful when adding extra spaces to improve readability.

No comments:

Post a Comment