parameters: (tg)
docstring: Task generator customising the options etc. to call Matlab in batch
  	mode for running a m-script.
docstring_summary: Task generator customising the options etc. to call Matlab in batch
  	mode for running a m-script.
docstring_tokens: Task generator customising the options etc . to call Matlab in batch mode for running a m - script .
function: def apply_run_m_script(tg):
  	"""Task generator customising the options etc. to call Matlab in batch
  	mode for running a m-script.
  	"""
  
  	# Convert sources and targets to nodes 
  	src_node = tg.path.find_resource(tg.source)
  	tgt_nodes = [tg.path.find_or_declare(t) for t in tg.to_list(tg.target)]
  
  	tsk = tg.create_task('run_m_script', src=src_node, tgt=tgt_nodes)
  	tsk.cwd = src_node.parent.abspath()
  	tsk.env.MSCRIPTTRUNK = os.path.splitext(src_node.name)[0]
  	tsk.env.LOGFILEPATH = os.path.join(tg.bld.bldnode.abspath(), '%s_%d.log' % (tsk.env.MSCRIPTTRUNK, tg.idx))
  
  	# dependencies (if the attribute 'deps' changes, trigger a recompilation)
  	for x in tg.to_list(getattr(tg, 'deps', [])):
  		node = tg.path.find_resource(x)
  		if not node:
  			tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.nice_path()))
  		tsk.dep_nodes.append(node)
  	Logs.debug('deps: found dependencies %r for running %r' % (tsk.dep_nodes, src_node.nice_path()))
  
  	# Bypass the execution of process_source by setting the source to an empty list
  	tg.source = []
function_tokens: def apply_run_m_script ( tg ) : # Convert sources and targets to nodes  src_node = tg . path . find_resource ( tg . source ) tgt_nodes = [ tg . path . find_or_declare ( t ) for t in tg . to_list ( tg . target ) ] tsk = tg . create_task ( 'run_m_script' , src = src_node , tgt = tgt_nodes ) tsk . cwd = src_node . parent . abspath ( ) tsk . env . MSCRIPTTRUNK = os . path . splitext ( src_node . name ) [ 0 ] tsk . env . LOGFILEPATH = os . path . join ( tg . bld . bldnode . abspath ( ) , '%s_%d.log' % ( tsk . env . MSCRIPTTRUNK , tg . idx ) ) # dependencies (if the attribute 'deps' changes, trigger a recompilation) for x in tg . to_list ( getattr ( tg , 'deps' , [ ] ) ) : node = tg . path . find_resource ( x ) if not node : tg . bld . fatal ( 'Could not find dependency %r for running %r' % ( x , src_node . nice_path ( ) ) ) tsk . dep_nodes . append ( node ) Logs . debug ( 'deps: found dependencies %r for running %r' % ( tsk . dep_nodes , src_node . nice_path ( ) ) ) # Bypass the execution of process_source by setting the source to an empty list tg . source = [ ]