function x = isS(S)
% x = isS(S)
% tries to find out if 'S' is a cell array of subdivision operators. Tests only formal stuff.
% to test if 'S' consists of meaningful subdiv operator, use getS(S) or getS(S,'bigcheck').
%
% E.g.: isS(getS(2))
%
% See also: isT, getS
%
% Written by: tommsch, 2016

x=false;

if(~iscell(S)); return; end;

sizeS=size(S,1); 

if(sizeS==0); return; end; %tests if there is at least on subdiv-operator
if(size(S,2)~=4); return; end; %tests if there are at least 4 elements per row

for i=1:sizeS
    a=S{i,1};
    M=S{i,2};
    D=S{i,3};
    name=S{i,end};
    
    if(~isnumeric(M)); return; end; %test if dilation matrices are symbolic
    if(~issquare(M)); return; end;  %test if dilation matrices are square
    if(~iswholenumber(M)); return; end; %test if dilation matrices have integer values
    
    if(~isa(a,'sequence')); return; end; %tests if masks are a cell array
    
    if(~isnumeric(D)); return; end; %test if M is symbolic        
    if(size(D,1) ~= size(M,1)); return; end; %tests if digits have the right dimension
    
    if(~ischar(name)); return; end; %test if name is a string
end

x=true;

end

function dummy; end %#ok<DEFNU> %Generates an error, if the 'end' of a function is missing. 