MATLAB: How do you troubleshoot error ‘Out of memory. The likely cause is an infinite recursion within the program.’

functioninfinite recursion

I am using a function called plotTAS that overlays points on a Total Alkali Silica (TAS) chart. However, when I try to run the function, I keep getting the error 'Out of memory. The likely cause is an infinite recursion within the program.' I don't know how to troubleshoot this problem. Attached is the code I am using.

Best Answer

Add the comments back in front of the line from
% EXAMPLES:
...
to
...
%%Create Figure
Those lines were, as the comment states, intended to be examples of how to use the function not actual code within the function.
But having them executable inside the function definition itself, function ploTAS calls itself which invocation calls itself which ... you should get the picture.