Sub-scripted Dimension Mismatch Error
1 view (last 30 days)
I am trying to create a table, with range breakpoints along the left hand vertical axis (starting at the 2nd row of the matrix a). But I can't seem to figure this error out.
I first create an empty matrix a.
Then I try to assign these values, starting at the 2nd row
range = [0 35 70 100 135 170 200 230 260 300]';
by using the following command
a(2:end,1) = range;
Now, shouldn't this assign the values of range, beginning at the second row of a, instead of the first? I get the error
Subscripted assignment dimension mismatch.
Todd Leonhardt on 25 May 2016
At the moment you are attempting to assign something to the 1st column row a (starting at the 2nd row), but a is a matrix of double precision floating-point numbers of dimensions 0 x 0. It doesn't have any data in it at all. So you are effectively attempting to assign things to memory which hasn't been allocated yet.
Now, if a already had a matrix where the in the first column was of sufficient size, then you could do this.
I don't know what you are trying to achieve with these "range breakpoints". Maybe you could use nan (not-a-number) values in their place?