MATLAB: Subscripted assignment dimension mismatch subscripted assignment dimension mismatch What does this error mean? Best Answer It comes from trying to assign something of one size to a set of indices that does not match that size. For example. X = randn(10,10); Y = randn(3,3); X(1:2,1:2) = Y;The block in X is 2 rows by 2 columns. The above tries to assign a matrix of numbers that is 3 rows by 3 columns. Related SolutionsMATLAB: How to assign parts of a matrix equal to a single vector It's because y(2:4, 2:4) is a 3x3 matrix, and so you must assign it a 3x3 matrix. The command repmat is an easy way to stack multiple copies of a matrix together. Assuming you want each of the rows of that 3x3 block to be [0 2 0]:x = [0 2 0];y(2:4, 2:4) = repmat(x, 3, 1); MATLAB: How to resolve subscript mismatch error LIP = repmat(temp(:),1,2); Related QuestionSubscripted assignment dimension mismatchConcatenation in a loopWhat does the statement Ytraining = Y(:,1:230e3); mean? here, matrix Y is a matrix of dimensions 256×119025
Best Answer