<gh_stars>0
import os.path as osp
def count_nout(path):
    '''count_nout
    Count number of output of .m function.
    '''
    if not osp.isabs(func_path):
        from oct2py import Oct2Py
        oc = Oct2Py()
        func_path = oc.which(func_path)

    nout = 0
    status = 'NOT FUNCTION'
    with open(func_path, encoding='utf8') as f:
        for l in f: 
            if l[0] != 'f': #not function
                if status == 'NOT FUNCTION':
                    continue
            l = l.translate(str.maketrans('', '', '[]()')).split()
            try:
                l.remove('function')
            except:
                pass
            for s in l:
                if s == '...':
                    status = 'FUNCTION'
                    continue
                if s != '=':
                    nout += 1
                else:
                    return nout
    return nout
import os.path as osp
def count_nout(path):
    '''count_nout
    Count number of output of .m function.
    '''
    if not osp.isabs(func_path):
        from oct2py import Oct2Py
        oc = Oct2Py()
        func_path = oc.which(func_path)

    nout = 0
    status = 'NOT FUNCTION'
    with open(func_path, encoding='utf8') as f:
        for l in f: 
            if l[0] != 'f': #not function
                if status == 'NOT FUNCTION':
                    continue
            l = l.translate(str.maketrans('', '', '[]()')).split()
            try:
                l.remove('function')
            except:
                pass
            for s in l:
                if s == '...':
                    status = 'FUNCTION'
                    continue
                if s != '=':
                    nout += 1
                else:
                    return nout
    return nout
count_nout     Count number of output of .m function. #not function