comparison m-toolbox/m/gui/gltpda/g_iplot.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_iplot(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_iplot.m,v 1.1 2008/03/01 13:43:20 nicola Exp $
11
12 setup(block);
13
14 %%
15 function setup(block)
16 global LTPDAinvar;
17
18 %% Register dialog parameter: none, because they're retrieved directly
19 %% from the memory. This will prevent the user to modify the parameters
20 %% outside the proper parameters panel:
21 block.NumDialogPrms = 0;
22
23 %% Register number of input and output ports
24 block.NumInputPorts = 1;
25 block.NumOutputPorts = 1;
26
27 %% Setup functional port properties to dynamically inherited.
28 block.SetPreCompInpPortInfoToDynamic;
29 block.SetPreCompOutPortInfoToDynamic;
30
31 block.InputPort(1).DirectFeedthrough = true;
32 block.InputPort(1).DatatypeID = 0;
33 block.InputPort(1).Complexity = 0;
34 % block.InputPort(1).Dimensions = 2;
35 block.OutputPort(1).DatatypeID = 0;
36 block.OutputPort(1).Complexity = 0;
37 % block.OutputPort(1).Dimensions = 1;
38 block.SampleTimes = [0 0];
39 block.SetAccelRunOnTLC(false);
40
41 %% Register methods
42 block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData);
43 block.RegBlockMethod('SetInputPortDimensions', @SetInpPortDims);
44 block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
45 block.RegBlockMethod('Outputs', @Outputs);
46
47 function SetInpPortFrameData(block, idx, fd)
48 block.InputPort(1).SamplingMode = fd;
49 block.OutputPort(1).SamplingMode = fd;
50
51 function SetInpPortDims(block, idx, di)
52 block.InputPort(idx).Dimensions = di;
53
54 function SetOutPortDims(block, idx, di)
55 block.OutputPort(idx).Dimensions = di;
56
57
58 %%
59 function Outputs(block)
60 global LTPDAinvar
61
62 % figure
63 hold on
64 switch length(block.InputPort(1).Data)
65 case 1
66 iplot(LTPDAinvar{block.InputPort(1).Data});
67 case 2
68 iplot(LTPDAinvar{block.InputPort(1).Data(1)},LTPDAinvar{block.InputPort(1).Data(2)});
69 case 3
70 iplot(LTPDAinvar{block.InputPort(1).Data(1)},LTPDAinvar{block.InputPort(1).Data(2)},LTPDAinvar{block.InputPort(1).Data(3)});
71 case 4
72 iplot(LTPDAinvar{block.InputPort(1).Data(1)},LTPDAinvar{block.InputPort(1).Data(2)},LTPDAinvar{block.InputPort(1).Data(3)},LTPDAinvar{block.InputPort(1).Data(4)});
73 end
74
75 % %========================================================================
76
77 block.OutputPort(1).Data = block.InputPort(1).Data;
78
79 %endfunction
80