MATLAB : I get the error ‘Subscript indices must either be real positive integers or logicals.

Error in Matlab

Sub­script indices must either be real pos­i­tive inte­gers or logicals.

SOLUTION
Issue was in me case, me vari­able had same name like func­tion max.
Example:

max = 100
A = [ 1 3 2 4; 1 2 3 6]
max (A) % max is func­tion in matlab

CAN HELP : www.mathworks.com