No BSD License  

Highlights from
simbus

from simbus by Sanjai Singh
The DataBus Blockset provides a method for manipulating signals from a vector in SIMULINK.

status=str2mask(blockhandle,stringmatrix)
function status=str2mask(blockhandle,stringmatrix)
%STR2MASK Sets entries in a mask dialog from a space padded string matrix.
%
%Does error checking if nargout > 0.
%
%Example:
%
% str2mask(get_param(gcb,'Handle'),str2mat('''bus1''','''alpha''','0','0'))
%
%See mask2str to do the converse.


%William York, 12/95.
%Copyright (c) 1995 by The MathWorks, Inc.

%$Revision: 1.1 $ $Date: 1997/02/11 20:51:54 $

% Check the sizes if nargout > 0
Version = version;
if (nargout > 0)
  status=0;
  CurrentEntries=mask2str(blockhandle);
  if (size(CurrentEntries) ~= size(stringmatrix))
    status=-1;
    return;
  end
end

% Update the mask
if strcmp(Version(1),'5')
  % Version 5.0/2.0 Syntax
  for ind = 1:size(stringmatrix,1)
    eval('entries{ind} = deblank(stringmatrix(ind,:));')
  end
  set_param(blockhandle,'MaskValues', entries);
else
  % Version 4.2c/1.3 Syntax
  entries = [ deblank(stringmatrix(1,:)) '\/' ];
  for ind = 2:size(stringmatrix,1)
    entries=[entries deblank(stringmatrix(ind,:)) '\/' ];
  end
  set_param(blockhandle,'Mask Entries',entries);
end

% Check if the mask was set correctly if nargout is > 0
if (nargout > 0)
  status=0;
  if strcmp(Version(1),'5')
    % Version 5.0/2.0
    NewEntries=get_param(blockhandle,'MaskValues');
  else
    % Version 4.2/1.3
    NewEntries=get_param(blockhandle,'Mask Entries');
  end    
  if (~isequal(NewEntries,entries))
    status=-2;
    return;
  end
end  


Contact us at files@mathworks.com