view m-toolbox/m/gui/gltpda/g_pl2ao.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_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;