diff m-toolbox/m/gui/gltpda/g_pl2ao.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/m/gui/gltpda/g_pl2ao.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,59 @@
+function g_pl2ao(block)
+% For the block plist2AO : let the user to build a plist and convert it
+% into an AO in memory at the time of execution.
+
+%  $Id: g_pl2ao.m,v 1.1 2008/03/01 13:43:20 nicola Exp $Revision: 1.1 $
+
+setup(block);
+  
+%%
+function setup(block)
+
+  %% Register dialog parameter: none, because they're retrieved directly
+  %% from the memory. This will prevent the user to modify the parameters
+  %% outside the proper parameters panel:
+  block.NumDialogPrms = 0;
+
+  %% Register number of input and output ports
+  block.NumInputPorts  = 0;
+  block.NumOutputPorts = 1;
+
+  %% Setup functional port properties to dynamically inherited.
+  block.SetPreCompOutPortInfoToDynamic;
+  
+  block.OutputPort(1).DatatypeID = 0;
+  block.OutputPort(1).Complexity = 0;
+  block.OutputPort(1).Dimensions = 1;
+  block.OutputPort(1).SamplingMode = 'sample';
+  block.SampleTimes = [0 0];
+  block.SetAccelRunOnTLC(false);
+ 
+  %% Register methods
+% block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
+  block.RegBlockMethod('Outputs',                 @Outputs);
+  
+% function SetOutPortDims(block, idx, di)
+% block.OutputPort(idx).Dimensions = 1;
+
+
+%%
+function Outputs(block)
+global LTPDAinvar
+
+  currhandle=gcbh;
+  currparent=get_param(currhandle,'Parent');
+
+  paramcommand = get_param(currparent,'Description');
+  eval(paramcommand)
+  try
+      outdata = ao(params);
+  catch
+      outdata = ao(1);
+  end
+
+
+  xx = size(LTPDAinvar,1);
+  LTPDAinvar(xx+1,:) = [num2cell(outdata),0];
+%   LTPDAinvar{xx+1} = {outdata,0};
+  block.OutputPort(1).Data = xx+1;
+