Home > m > gui > gltpda > g_resp.m

g_resp

PURPOSE ^

$Id: g_resp.m,v 1.1 2008/03/01 13:43:20 nicola Exp $

SYNOPSIS ^

function g_resp(block)

DESCRIPTION ^

  $Id: g_resp.m,v 1.1 2008/03/01 13:43:20 nicola Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function g_resp(block)
0002 
0003 %  $Id: g_resp.m,v 1.1 2008/03/01 13:43:20 nicola Exp $
0004 
0005 setup(block);
0006   
0007 %%
0008 function setup(block)
0009 
0010   %% Register dialog parameter: none, because they're retrieved directly
0011   %% from the memory. This will prevent the user to modify the parameters
0012   %% outside the proper parameters panel:
0013   block.NumDialogPrms = 0;
0014 
0015   %% Register number of input and output ports
0016   block.NumInputPorts  = 1;
0017   block.NumOutputPorts = 1;
0018 
0019   %% Setup functional port properties to dynamically inherited.
0020   block.SetPreCompOutPortInfoToDynamic;
0021   
0022   block.InputPort(1).DirectFeedthrough = true;
0023   block.InputPort(1).DatatypeID = 0;
0024   block.InputPort(1).Complexity = 0;
0025   block.InputPort(1).SamplingMode = 'sample';
0026   block.OutputPort(1).DatatypeID = 0;
0027   block.OutputPort(1).Complexity = 0;
0028   block.OutputPort(1).Dimensions = 1;
0029   block.OutputPort(1).SamplingMode = 'sample';
0030   block.SampleTimes = [0 0];
0031   block.SetAccelRunOnTLC(false);
0032   
0033   
0034 
0035   %% Register methods
0036   block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData);
0037   block.RegBlockMethod('SetInputPortDimensions',  @SetInpPortDims);
0038 % block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
0039   block.RegBlockMethod('Outputs',                 @Outputs);
0040 
0041    function SetInpPortDims(block, idx, di)
0042   block.InputPort(idx).Dimensions = di;
0043 
0044     function SetInpPortFrameData(block, idx, fd)
0045   block.InputPort(1).SamplingMode = fd;
0046   block.OutputPort(1).SamplingMode = fd;
0047   
0048 %  function SetOutPortDims(block, idx, di)
0049 % block.OutputPort(idx).Dimensions = 1;
0050 
0051 
0052 %%
0053 function Outputs(block)
0054 global LTPDAinvar
0055 
0056   
0057   currhandle=gcbh;
0058   currparent=get_param(currhandle,'Parent');
0059   
0060   paramcommand = get_param(currparent,'Description');
0061   eval(paramcommand)
0062   
0063   
0064   
0065   data = get(params.params(1),'val');
0066   aodata = find(params,'AO data');
0067   if ~isempty(aodata)
0068       currparam = LTPDAinvar{block.InputPort(1).Data,1}.data.x;
0069   end
0070   
0071   outdata=resp(data,currparam);
0072   outdata = num2cell(outdata);
0073 
0074   xx = size(LTPDAinvar,1);
0075   LTPDAinvar(xx+1,:) = [outdata,0];
0076   block.OutputPort(1).Data = xx+1;

Generated on Mon 31-Mar-2008 21:41:00 by m2html © 2003