view m-toolbox/m/gui/gltpda/g_resp.m @ 43:bc767aaa99a8

CVS Update
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 11:09:25 +0100
parents f0afece42f48
children
line wrap: on
line source

function g_resp(block)

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

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  = 1;
  block.NumOutputPorts = 1;

  %% Setup functional port properties to dynamically inherited.
  block.SetPreCompOutPortInfoToDynamic;
  
  block.InputPort(1).DirectFeedthrough = true;
  block.InputPort(1).DatatypeID = 0;
  block.InputPort(1).Complexity = 0;
  block.InputPort(1).SamplingMode = 'sample';
  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('SetInputPortSamplingMode',@SetInpPortFrameData);
  block.RegBlockMethod('SetInputPortDimensions',  @SetInpPortDims);
% block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
  block.RegBlockMethod('Outputs',                 @Outputs);

   function SetInpPortDims(block, idx, di)
  block.InputPort(idx).Dimensions = di;

    function SetInpPortFrameData(block, idx, fd)
  block.InputPort(1).SamplingMode = fd;
  block.OutputPort(1).SamplingMode = fd;
  
%  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)
  
  
  
  data = get(params.params(1),'val');
  aodata = find(params,'AO data');
  if ~isempty(aodata)
      currparam = LTPDAinvar{block.InputPort(1).Data,1}.data.x;
  end
  
  outdata=resp(data,currparam);
  outdata = num2cell(outdata);

  xx = size(LTPDAinvar,1);
  LTPDAinvar(xx+1,:) = [outdata,0];
  block.OutputPort(1).Data = xx+1;