comparison m-toolbox/m/gui/gltpda/g_copyparams.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_copyparams(block)
2
3 % This is the automatic function wrapper
4 % =================================================================
5 % ================ level-2 M file S-function ======================
6 % =================================================================
7 % To save as standalone variable(s) into global shared workspace the AO(s)
8 % received as input from the corresponding block, executed in Simulink.
9 %
10 % $Id: g_copyparams.m,v 1.1 2008/03/01 13:43:20 nicola Exp $
11
12 setup(block);
13
14 %%
15 function setup(block)
16
17 %% Register dialog parameter: none, because they're retrieved directly
18 %% from the memory. This will prevent the user to modify the parameters
19 %% outside the proper parameters panel:
20 block.NumDialogPrms = 0;
21
22 %% Register number of input and output ports
23 block.NumInputPorts = 2;
24 block.NumOutputPorts = 1;
25
26 %% Setup functional port properties to dynamically inherited.
27 block.SetPreCompInpPortInfoToDynamic;
28 block.SetPreCompOutPortInfoToDynamic;
29
30 block.InputPort(1).DirectFeedthrough = true;
31 block.InputPort(1).DatatypeID = 0;
32 block.InputPort(1).Complexity = 0;
33 % block.InputPort(1).Dimensions = 2;
34 block.InputPort(2).DirectFeedthrough = true;
35 block.InputPort(2).DatatypeID = 0;
36 block.InputPort(2).Complexity = 0;
37 % block.InputPort(2).Dimensions = 2;
38 block.OutputPort(1).DatatypeID = 0;
39 block.OutputPort(1).Complexity = 0;
40 % block.OutputPort(1).Dimensions = 1;
41 block.SampleTimes = [0 0];
42 block.SetAccelRunOnTLC(false);
43
44 %% Register methods
45 % block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData);
46 block.RegBlockMethod('SetInputPortDimensions', @SetInpPortDims);
47 block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
48 block.RegBlockMethod('Outputs', @Outputs);
49
50 % function SetInpPortFrameData(block, idx, fd)
51 % block.InputPort(1).SamplingMode = fd;
52 % block.OutputPort(1).SamplingMode = fd;
53
54 function SetInpPortDims(block, idx, di)
55 block.InputPort(idx).Dimensions = di;
56
57 function SetOutPortDims(block, idx, di)
58 block.OutputPort(idx).Dimensions = di;
59
60 %%
61 function Outputs(block)
62
63 % currBlk=get(gcbh,'Parent');
64 currBlkConnect=get_param(get(gcbh,'Parent'),'PortConnectivity');
65 parentBlkHandle=currBlkConnect(2).SrcBlock;
66 childBlkHandle=currBlkConnect(3).DstBlock;
67 param2copy=get_param(parentBlkHandle,'Description');
68 set_param(childBlkHandle,'Description',param2copy);
69 annotation=get_param(parentBlkHandle,'AttributesFormatString');
70 set_param(childBlkHandle,'AttributesFormatString',annotation);
71
72 block.OutputPort(1).Data = block.InputPort(1).Data;
73
74 %endfunction
75