Tag Archives: MATLAB notes

Matlab prompt error

Enter the following code
(1)

a = [1 2;3 4];
a(6) = 7;

Prompt:
attempt to grow array along ambiguous dimension.
in Chinese:
attempt to grow large array along fuzzy dimension

The following codes are correct
(2)

a = [1 2;3 4];
a(5, 8) = 7;

Why is it that code (1) is wrong and code (2) is at a loss when it exceeds the predefined matrix size?

The cause of the problem is as indicated in the prompt

, the program cannot determine the dimension of the matrix.
What do you mean?
Although the code segment (2) exceeds the predefined matrix dimension: 2-by-2, it can determine the matrix dimension after an assignment (a (5, 8) = 7): 5-by-8.
The code segment (1) is a linear index -- 6, which is converted to a matrix subscript of 2-by-3 or 3-by-2??
The computer doesn't know, so it reports an error. " attempts to grow data along fuzzy dimensions ". This tip, feel very awkward, in fact, is very correct .