Actually, your guess is correct. Since Matlab is not a strongly typed language and there is no classic overload function, the function must be aware of the value of the context argument. Mathworks wanted to combine both maxima in one matrix and along two arrays in one function.
Therefore, they must somehow separate these cases. And they use the empty matrix [] as a placeholder. Otherwise, they will not be able to separate the cases max(A, dim) and max(A, B) . For this purpose they could use any special variable, but [] is a fundamental construction.
source share