Mercurial > hg > ltpda
comparison m-toolbox/m/gui/gltpda/g_resp.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function g_resp(block) | |
2 | |
3 % $Id: g_resp.m,v 1.1 2008/03/01 13:43:20 nicola Exp $ | |
4 | |
5 setup(block); | |
6 | |
7 %% | |
8 function setup(block) | |
9 | |
10 %% Register dialog parameter: none, because they're retrieved directly | |
11 %% from the memory. This will prevent the user to modify the parameters | |
12 %% outside the proper parameters panel: | |
13 block.NumDialogPrms = 0; | |
14 | |
15 %% Register number of input and output ports | |
16 block.NumInputPorts = 1; | |
17 block.NumOutputPorts = 1; | |
18 | |
19 %% Setup functional port properties to dynamically inherited. | |
20 block.SetPreCompOutPortInfoToDynamic; | |
21 | |
22 block.InputPort(1).DirectFeedthrough = true; | |
23 block.InputPort(1).DatatypeID = 0; | |
24 block.InputPort(1).Complexity = 0; | |
25 block.InputPort(1).SamplingMode = 'sample'; | |
26 block.OutputPort(1).DatatypeID = 0; | |
27 block.OutputPort(1).Complexity = 0; | |
28 block.OutputPort(1).Dimensions = 1; | |
29 block.OutputPort(1).SamplingMode = 'sample'; | |
30 block.SampleTimes = [0 0]; | |
31 block.SetAccelRunOnTLC(false); | |
32 | |
33 | |
34 | |
35 %% Register methods | |
36 block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData); | |
37 block.RegBlockMethod('SetInputPortDimensions', @SetInpPortDims); | |
38 % block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims); | |
39 block.RegBlockMethod('Outputs', @Outputs); | |
40 | |
41 function SetInpPortDims(block, idx, di) | |
42 block.InputPort(idx).Dimensions = di; | |
43 | |
44 function SetInpPortFrameData(block, idx, fd) | |
45 block.InputPort(1).SamplingMode = fd; | |
46 block.OutputPort(1).SamplingMode = fd; | |
47 | |
48 % function SetOutPortDims(block, idx, di) | |
49 % block.OutputPort(idx).Dimensions = 1; | |
50 | |
51 | |
52 %% | |
53 function Outputs(block) | |
54 global LTPDAinvar | |
55 | |
56 | |
57 currhandle=gcbh; | |
58 currparent=get_param(currhandle,'Parent'); | |
59 | |
60 paramcommand = get_param(currparent,'Description'); | |
61 eval(paramcommand) | |
62 | |
63 | |
64 | |
65 data = get(params.params(1),'val'); | |
66 aodata = find(params,'AO data'); | |
67 if ~isempty(aodata) | |
68 currparam = LTPDAinvar{block.InputPort(1).Data,1}.data.x; | |
69 end | |
70 | |
71 outdata=resp(data,currparam); | |
72 outdata = num2cell(outdata); | |
73 | |
74 xx = size(LTPDAinvar,1); | |
75 LTPDAinvar(xx+1,:) = [outdata,0]; | |
76 block.OutputPort(1).Data = xx+1; |