MATLAB: Does M-Lint show me a message “END or Colon is apparently used to index an non-array” in MATLAB 7.5 (R2007b)

MATLABmlint

In the attached example M-Lint displays a message in line 38 for the colon:
ann = an(r,:);
As "an" is not defined before, but will be written out of the Simulink model to the current workspace "an" will be known and the program will run as expected.
If I comment out the function line and execute the code as a script this message does not occur.

Best Answer

M-Lint shows the message because in its static analysis, it is unable to determine that "an" is a variable. It assumes it is a function and therefore shows that warning. It does not show an error for the statement,
ann = an(r,1:k);
because this is a valid method of accessing a function (passing the vector 1:k as input), and therefore fits in M-Lints assumption about "an". However,
ann = an(r,:);
is not a valid function call and results in an M-Lint error.
This behavior is a little confusing and has been improved in MATLAB version 7.7 (R2008b) and above.