Mercurial > hg > ltpda
comparison m-toolbox/m/gui/gltpda/g_plot.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_plot(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_plot.m,v 1.1 2008/03/01 13:43:20 nicola Exp $ | |
11 | |
12 setup(block); | |
13 | |
14 %% | |
15 function setup(block) | |
16 global AnOb; | |
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 AnOb | |
61 | |
62 y=length(block.InputPort(1).Data); | |
63 figure | |
64 hold on | |
65 for j=1:y | |
66 plot(AnOb{block.InputPort(1).Data(j)}) | |
67 end | |
68 | |
69 % %======================================================================== | |
70 | |
71 block.OutputPort(1).Data = block.InputPort(1).Data; | |
72 | |
73 %endfunction | |
74 |