MATLAB: Detect P-code

deploymentdiagnosticsMATLABpcode

Is there a way for a function to query if it is running from an m-file or if it has been deployed as a p-file. The function "isdeployed()" returns zero for p-code. Is there anything equivalent to "ispcode()"?
Thanks
Ronan

Best Answer

  • Maybe this:
    a=dbstack('-completenames');
    if (isempty(strfind(a.file,'.m')))
    disp('pcode')
    else
    disp('mfile')
    end