function varargout = dspblktrigtwks(action, varargin)
% DSPBLKTSTW DSP Blockset Triggered To Workspace
%   block helper function.

% Copyright 1995-2000 The MathWorks, Inc.
% $Revision: 1.2 $ $Date: 2000/04/29 22:54:48 $

blk = gcb;

if nargin==0, action='dynamic'; end

switch action

case 'init'
  
  % Copy all mask entries to structure:
  n = get_param(blk,'masknames');
  params = cell2struct(varargin,n,2);

   % Update trigger:
   switch params.TriggerType
   case 1, edge='rising';
   case 2, edge='falling';
   case 3, edge='either';
   end
   trigBlk = [blk '/Trigger'];
   v = get_param(trigBlk,'TriggerType');
   if ~strcmp(v, edge)
      set_param(trigBlk,'TriggerType',edge);
   end
   
   % Update workspace variable name:
   stwBlk = [blk '/To Workspace'];
   v = get_param(stwBlk, 'VariableName');
   if ~strcmp(v, params.VariableName);
      set_param(stwBlk, 'VariableName', params.VariableName);
   end
   
end

% [EOF] dspblktrigtwks.m
