Home > m > gui > gltpda > g_saveresult.m

g_saveresult

PURPOSE ^

This is the automatic function wrapper

SYNOPSIS ^

function g_saveresult(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_saveresult.m,v 1.4 2008/03/21 16:13:54 nicola Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function g_saveresult(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_saveresult.m,v 1.4 2008/03/21 16:13:54 nicola Exp $
0011 
0012 setup(block);
0013   
0014 %%
0015 function setup(block)
0016 
0017   %% Register dialog parameter: none, because they're retrieved directly
0018   %% from the memory. This will prevent the user to modify the parameters
0019   %% outside the proper parameters panel:
0020   block.NumDialogPrms = 0;
0021 
0022   %% Register number of input and output ports
0023   block.NumInputPorts  = 1;
0024   block.NumOutputPorts = 1;
0025 
0026   %% Setup functional port properties to dynamically inherited.
0027   block.SetPreCompInpPortInfoToDynamic;
0028   block.SetPreCompOutPortInfoToDynamic;
0029   
0030   block.InputPort(1).DirectFeedthrough = true;
0031   block.InputPort(1).DatatypeID = 0;
0032   block.InputPort(1).Complexity = 0;
0033 % block.InputPort(1).Dimensions = 2;
0034   block.OutputPort(1).DatatypeID = 0;
0035   block.OutputPort(1).Complexity = 0;
0036 % block.OutputPort(1).Dimensions = 1;
0037   block.SampleTimes = [0 0];
0038   block.SetAccelRunOnTLC(false);
0039  
0040   %% Register methods
0041   block.RegBlockMethod('SetInputPortSamplingMode',@SetInpPortFrameData);
0042   block.RegBlockMethod('SetInputPortDimensions',  @SetInpPortDims);
0043   block.RegBlockMethod('SetOutputPortDimensions', @SetOutPortDims);
0044   block.RegBlockMethod('Outputs',                 @Outputs);
0045   
0046   function SetInpPortFrameData(block, idx, fd)
0047   block.InputPort(1).SamplingMode = fd;
0048   block.OutputPort(1).SamplingMode = fd;
0049 
0050   function SetInpPortDims(block, idx, di)
0051   block.InputPort(idx).Dimensions = di;
0052 
0053   function SetOutPortDims(block, idx, di)
0054   block.OutputPort(idx).Dimensions = di;
0055 
0056 
0057 %%
0058 function Outputs(block)
0059 global LTPDAinvar LTPDAoutvar
0060 
0061 % Check if the user wants to stop the execution:
0062 lastChar = get(findobj('Name','LTPDA Progress Bar'),'CurrentCharacter');
0063 if ~isempty(lastChar) && strcmp(lastChar,'x')
0064     set_param(bdroot, 'SimulationCommand', 'stop')
0065     return
0066 end
0067 
0068 y = numel(block.InputPort(1).Data);
0069 for j=1:y
0070     yy = numel(LTPDAinvar{block.InputPort(1).Data(j)});
0071     if yy >1
0072         for jj=1:yy
0073             LTPDAoutvar = [LTPDAoutvar;{LTPDAinvar{block.InputPort(1).Data(j)}(jj)}];
0074         end
0075     else
0076         LTPDAoutvar = [LTPDAoutvar;{LTPDAinvar{block.InputPort(1).Data(j)}}];
0077     end
0078 end
0079 
0080 % %========================================================================
0081 
0082 block.OutputPort(1).Data = block.InputPort(1).Data;
0083 
0084 %endfunction
0085

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003