Home > m > gui > gltpda > g_plot.m

g_plot

PURPOSE ^

This is the automatic function wrapper

SYNOPSIS ^

function g_plot(block)

DESCRIPTION ^

             This is the automatic function wrapper
 =================================================================
 ================ level-2 M file S-function ======================
 =================================================================
 To save as standalone variable(s) into global shared workspace the AO(s)
 received as input from the corresponding block, executed in Simulink.

  $Id: g_plot.m,v 1.1 2008/03/01 13:43:20 nicola Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function g_plot(block)
0002 
0003 %             This is the automatic function wrapper
0004 % =================================================================
0005 % ================ level-2 M file S-function ======================
0006 % =================================================================
0007 % To save as standalone variable(s) into global shared workspace the AO(s)
0008 % received as input from the corresponding block, executed in Simulink.
0009 %
0010 %  $Id: g_plot.m,v 1.1 2008/03/01 13:43:20 nicola Exp $
0011 
0012 setup(block);
0013   
0014 %%
0015 function setup(block)
0016 global AnOb;
0017 
0018   %% Register dialog parameter: none, because they're retrieved directly
0019   %% from the memory. This will prevent the user to modify the parameters
0020   %% outside the proper parameters panel:
0021   block.NumDialogPrms = 0;
0022 
0023   %% Register number of input and output ports
0024   block.NumInputPorts  = 1;
0025   block.NumOutputPorts = 1;
0026 
0027   %% Setup functional port properties to dynamically inherited.
0028   block.SetPreCompInpPortInfoToDynamic;
0029   block.SetPreCompOutPortInfoToDynamic;
0030   
0031   block.InputPort(1).DirectFeedthrough = true;
0032   block.InputPort(1).DatatypeID = 0;
0033   block.InputPort(1).Complexity = 0;
0034 % block.InputPort(1).Dimensions = 2;
0035   block.OutputPort(1).DatatypeID = 0;
0036   block.OutputPort(1).Complexity = 0;
0037 % block.OutputPort(1).Dimensions = 1;
0038   block.SampleTimes = [0 0];
0039   block.SetAccelRunOnTLC(false);
0040  
0041   %% Register methods
0042   block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData);
0043   block.RegBlockMethod('SetInputPortDimensions',  @SetInpPortDims);
0044   block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
0045   block.RegBlockMethod('Outputs',                 @Outputs);
0046   
0047   function SetInpPortFrameData(block, idx, fd)
0048   block.InputPort(1).SamplingMode = fd;
0049   block.OutputPort(1).SamplingMode = fd;
0050 
0051   function SetInpPortDims(block, idx, di)
0052   block.InputPort(idx).Dimensions = di;
0053 
0054   function SetOutPortDims(block, idx, di)
0055   block.OutputPort(idx).Dimensions = di;
0056 
0057 
0058 %%
0059 function Outputs(block)
0060 global AnOb
0061 
0062 y=length(block.InputPort(1).Data);
0063 figure
0064 hold on
0065 for j=1:y
0066     plot(AnOb{block.InputPort(1).Data(j)})
0067 end
0068 
0069 % %========================================================================
0070 
0071    block.OutputPort(1).Data = block.InputPort(1).Data;
0072 
0073 %endfunction
0074

Generated on Mon 31-Mar-2008 13:54:54 by m2html © 2003