https://se.mathworks.com/help/matlab/apiref/mxisfromglobalws_fortran.html
mxIsFromGlobalWS (Fortran) - Determine whether mxArray was copied from MATLAB global workspace -...
The function returns 1 if the array was copied out of the global workspace.
fortrandeterminewhether